<!--
{
  "documentType" : "article",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/argument-buffer-resource-preparation-commands",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Argument buffer resource preparation commands"
}
-->

# Argument buffer resource preparation commands

Load individual resources and multiple resources within a heap into GPU memory so that they’re available to shaders through argument buffers.

## Discussion

These methods encode commands that load resources into GPU memory, making them accessible to your shaders through argument buffers.
To load an individual resource, call the [`useResource(_:usage:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useResource(_:usage:stages:)) method, or another resource-based method.
Alternatively, you can load all the resources within a heap by calling the [`useHeap(_:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useHeap(_:stages:)) method or another heap-based method.

> Important:
> The heap-based methods don’t provide a `usage` parameter (see ``doc://com.apple.metal/documentation/Metal/MTLResourceUsage``) and set the usage for the resources within each heap to ``doc://com.apple.metal/documentation/Metal/MTLResourceUsage/read``.

To give shaders write or read/write access to specific resources within a heap, call a resource-based method after the heap-based method.
Metal combines usage modes you set for a resource through both heap and resource methods.

For more information, see [Improving CPU performance by using argument buffers](/documentation/Metal/improving-cpu-performance-by-using-argument-buffers).

## Topics

### Loading individual resources for argument buffers

[`useResource(_:usage:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useResource(_:usage:stages:))

Ensures the shaders in the render pass’s subsequent draw commands have access to a resource.

[`useResources(_:usage:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useResources(_:usage:stages:))

Ensures the shaders in the render pass’s subsequent draw commands have access to multiple resources.

[`useResources:count:usage:stages:`](/documentation/Metal/MTLRenderCommandEncoder/useResources:count:usage:stages:)

Ensures the shaders in the render pass’s subsequent draw commands have access to multiple resources.

### Loading heaps and the resources they contain for argument buffers

[`useHeap(_:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useHeap(_:stages:))

Ensures the shaders in the render pass’s subsequent draw commands have access to the resources you allocate from a heap.

[`useHeaps(_:stages:)`](/documentation/Metal/MTLRenderCommandEncoder/useHeaps(_:stages:))

Ensures the shaders in the render pass’s subsequent draw commands have access to the resources you allocate from multiple heaps.

[`useHeaps:count:stages:`](/documentation/Metal/MTLRenderCommandEncoder/useHeaps:count:stages:)

Ensures the shaders in the render pass’s subsequent draw commands have access to the resources you allocate from multiple heaps.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)