---
title: "setFragmentAccelerationStructure(_:bufferIndex:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setfragmentaccelerationstructure(_:bufferindex:)"
---

# setFragmentAccelerationStructure(_:bufferIndex:)

Assigns an acceleration structure to an entry in the fragment shader argument table.

## Declaration

```swift
func setFragmentAccelerationStructure(_ accelerationStructure: (any MTLAccelerationStructure)?, bufferIndex: Int)
```

## Parameters

- `accelerationStructure`: An doc://com.apple.metal/documentation/Metal/MTLAccelerationStructure instance the command assigns to an entry in the fragment shader argument table for acceleration structures.
- `bufferIndex`: An integer that represents the entry in the fragment shader argument table for acceleration structures that stores a record of accelerationStructure.

## Discussion

Discussion By default, the acceleration structure at each index is nil.
