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

# useHeap(_:)

Makes the resources contained in the specified heap available to the acceleration structure pass.

```
func useHeap(_ heap: any MTLHeap)
```

## Parameters

`heap`

A heap that contains resources within an argument buffer.

## Discussion

This method makes all the resources in the heap resident for the duration of a compute pass and ensures that they’re in a format compatible with the compute function.

Call this method before issuing any dispatch calls that may access the resources in the heap.

You can only read or sample resources in the specified heap. This method ignores render targets (textures that specify a [`renderTarget`](/documentation/Metal/MTLTextureUsage/renderTarget) usage option) and writable textures (textures that specify a [`shaderWrite`](/documentation/Metal/MTLTextureUsage/shaderWrite) usage option) within the heap. To use these resources, you need to call the [`useResource(_:usage:)`](/documentation/Metal/MTLComputeCommandEncoder/useResource(_:usage:)) method instead.

> Note:
> You can synchronize memory operations to address dependency hazards with ``doc://com.apple.metal/documentation/Metal/MTLFence`` instances.

---

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)