---
title: "setAccelerationStructure(_:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlargumentencoder/setaccelerationstructure(_:index:)"
---

# setAccelerationStructure(_:index:)

Encodes a reference to an acceleration structure into the argument buffer.

## Declaration

```swift
func setAccelerationStructure(_ accelerationStructure: (any MTLAccelerationStructure)?, index: Int)
```

## Parameters

- `accelerationStructure`: An acceleration structure the method encodes.
- `index`: The index of an acceleration structure within the argument buffer. The value corresponds to either the index ID of a declaration in Metal Shading Language (MSL) or the doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor/index property of an doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor instance.
