<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputeCommandEncoder/useResources:count:usage:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputeCommandEncoder(im)useResources:count:usage:"
  },
  "title" : "useResources:count:usage:"
}
-->

# useResources:count:usage:

Ensures kernel calls that the system encodes in subsequent commands have access to multiple resources.

```
- (void) useResources:(id<MTLResource> const[]) resources count:(NSUInteger) count usage:(MTLResourceUsage) usage;
```

## Parameters

`resources`

An array of [`MTLResource`](/documentation/Metal/MTLResource) instances used in one or more argument buffers.

`count`

The number of resources in the array.

`usage`

All the applicable access types the compute pass’s use of these resources, including [`read`](/documentation/Metal/MTLResourceUsage/read) and [`write`](/documentation/Metal/MTLResourceUsage/write). Your resource usage type applies to all resources passed to this method call.

    For applicable resources, you may be able to prevent the GPU from unnecessarily decompressing color attachments on some devices by setting     `usage`     to [`read`](/documentation/Metal/MTLResourceUsage/read)    .

## Discussion

You can make many resources *resident* (available in GPU memory) for the remaining duration of the compute pass by calling this method. Call the method before encoding function calls that may access these `resources` through an argument buffer. The method ensures the resource is in a format that’s compatible with the kernels that depend on it.

> Note:
> You don’t need to call this method if you bind a resource for compute kernels to access.

The method also informs Metal when to apply hazard tracking for a resource you create with [`MTLHazardTrackingMode.tracked`](/documentation/Metal/MTLHazardTrackingMode/tracked). For a resource you create with [`MTLHazardTrackingMode.untracked`](/documentation/Metal/MTLHazardTrackingMode/untracked), you need to apply an [`MTLFence`](/documentation/Metal/MTLFence) or an [`MTLEvent`](/documentation/Metal/MTLEvent) to account for potential reading and writing hazards.

You can reconfigure an individual resource’s `usage` options for subsequent draw calls with the [`useResource(_:usage:)`](/documentation/Metal/MTLComputeCommandEncoder/useResource(_:usage:)) method.

Apps typically call this method for a resource in an argument buffer as a part of their *bindless* implementation. For more information about argument buffers and bindless implementations, see [Improving CPU performance by using argument buffers](/documentation/Metal/improving-cpu-performance-by-using-argument-buffers) and [Go bindless with Metal 3](https://developer.apple.com/videos/play/wwdc2022/10101/), respectively.

---

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)