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

# useHeaps(_:)

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

```
func useHeaps(_ heaps: [any MTLHeap])
```

## Parameters

`heaps`

The sets of heap that contain resources to mark as used.

## Discussion

This method makes all the resources in multiple heaps 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)