---
title: "executeCommands(in:indirectBuffer:indirectBufferOffset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcomputecommandencoder/executecommands(in:indirectbuffer:indirectbufferoffset:)"
---

# executeCommands(in:indirectBuffer:indirectBufferOffset:)

Encodes an instruction to run commands from an indirect buffer, using another buffer to provide the command range.

## Declaration

```swift
func executeCommands(in indirectCommandbuffer: any MTLIndirectCommandBuffer, indirectBuffer indirectRangeBuffer: any MTLBuffer, indirectBufferOffset: Int)
```

## Parameters

- `indirectCommandbuffer`: The doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBuffer instance containing the commands to execute.
- `indirectRangeBuffer`: An indirect buffer containing the execution range, laid out in an doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBufferExecutionRange instance. The maximum length of the range is 16384 commands.
- `indirectBufferOffset`: The number of bytes from the start of indirectRangeBuffer containing the execution range to use. Align the offset on a multiple of 4.

## See Also

### Dispatching from indirect command buffers

- [dispatchThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerThreadgroup:)](metal/mtlcomputecommandencoder/dispatchthreadgroups(indirectbuffer:indirectbufferoffset:threadsperthreadgroup:).md)
- [executeCommandsInBuffer(_:range:)](metal/mtlcomputecommandencoder/executecommandsinbuffer(_:range:).md)
- [executeCommandsInBuffer(_:indirectBuffer:offset:)](metal/mtlcomputecommandencoder/executecommandsinbuffer(_:indirectbuffer:offset:).md)
- [executeCommands(in:with:)](metal/mtlcomputecommandencoder/executecommands(in:with:).md)
