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

# setIndirectCommandBuffer(_:index:)

Encodes a reference to an indirect command buffer into the argument buffer.

## Declaration

```swift
func setIndirectCommandBuffer(_ indirectCommandBuffer: (any MTLIndirectCommandBuffer)?, index: Int)
```

## Parameters

- `indirectCommandBuffer`: An indirect command-buffer the method encodes.
- `index`: The index of an inline, constant-data argument 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.

## See Also

### Encoding indirect command buffers

- [setIndirectCommandBuffers(_:range:)](metal/mtlargumentencoder/setindirectcommandbuffers(_:range:).md)
