---
title: "useResource(_:usage:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlaccelerationstructurecommandencoder/useresource(_:usage:)"
---

# useResource(_:usage:)

Makes a resource available to the acceleration structure pass.

## Declaration

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

## Parameters

- `resource`: A specific resource within an argument buffer.
- `usage`: The options that describe how the compute function uses the resource.

## Discussion

Discussion This method makes the resource resident for the duration of a compute pass and ensures that it’s in a format compatible with the compute function. Call this method before issuing any dispatch calls that may access the resource. Calling this method again, or calling useHeap(_:), overwrites any previously specified usage options for future dispatch calls within the same compute command encoder. note: You can track resource access and dependency hazards with MTLFence instances.

## See Also

### Making indirect resources resident

- [useHeap(_:)](metal/mtlaccelerationstructurecommandencoder/useheap(_:).md)
- [useHeaps(_:)](metal/mtlaccelerationstructurecommandencoder/useheaps(_:).md)
- [useResources(_:usage:)](metal/mtlaccelerationstructurecommandencoder/useresources(_:usage:).md)
- [MTLResourceUsage](metal/mtlresourceusage.md)
