<!--
{
  "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/useHeaps:count:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLAccelerationStructureCommandEncoder(im)useHeaps:count:"
  },
  "title" : "useHeaps:count:"
}
-->

# useHeaps:count:

Specifies that an array of heaps containing resources in an argument buffer can be safely used by the acceleration structure pass.

```
- (void) useHeaps:(id<MTLHeap> const[]) heaps count:(NSUInteger) count;
```

## Parameters

`heaps`

An array of heaps that contains resources within an argument buffer.

`count`

The number of heaps in the array.

## Discussion

This method makes all the resources in the array of 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 array of heaps.

Resources within the specified array of heaps can only be read or sampled from. 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 array of heaps. 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)