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

# useResource(_:usage:)

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

```
func useResource(_ resource: any MTLResource, usage: MTLResourceUsage)
```

## Parameters

`resource`

An [`MTLResource`](/documentation/Metal/MTLResource) instance that subsequent draw commands depend on.

`usage`

All the applicable access types the render pass’s shaders use for `resource`, including [`read`](/documentation/Metal/MTLResourceUsage/read) and [`write`](/documentation/Metal/MTLResourceUsage/write).

    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 a resource *resident* (available in GPU memory) for the remaining duration of the render pass by calling this method. Call the method before encoding draw calls that may access `resource` through an argument buffer. The method ensures the resource is in a format that’s compatible with the shaders that depend on it.

> Note:
> You don’t need to call this method if you bind a resource to a shader stage.

For example, you can explicitly bind resources for the vertex stage with the methods in the [Vertex shader resource preparation commands](/documentation/Metal/vertex-shader-resource-preparation-commands) collection.

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 in the same render pass by calling this method again.

Apps typically call the 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)