---
title: "executeCommandsInBuffer(_:indirectBuffer:offset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/executecommandsinbuffer(_:indirectbuffer:offset:)"
---

# executeCommandsInBuffer(_:indirectBuffer:offset:)

Encodes a command that runs an indirect range of commands from an indirect command buffer (ICB).

## Declaration

```swift
func executeCommandsInBuffer(_ buffer: any MTLIndirectCommandBuffer, indirectBuffer indirectRangeBuffer: any MTLBuffer, offset: Int)
```

## Parameters

- `buffer`: An doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBuffer instance that contains other commands the current command runs.
- `indirectRangeBuffer`: An doc://com.apple.metal/documentation/Metal/MTLBuffer instance with data that matches the layout of the doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBufferExecutionRange structure. When running on Metal devices that belong to the doc://com.apple.metal/documentation/Metal/MTLGPUFamily/mac2 GPU family, the maximum value for the doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBufferExecutionRange/length property of that structure is 0x4000 (16,384). Metal devices that belong to an Apple silicon family, such as doc://com.apple.metal/documentation/Metal/MTLGPUFamily/apple10, don’t have this limitation.
- `offset`: An integer that represents the location, in bytes, from the start of indirectRangeBuffer where the execution range structure begins. See the https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf to check for offset alignment requirements for buffers in device and constant address space.

## See Also

### Running commands from indirect command buffers

- [executeCommandsInBuffer(_:range:)](metal/mtlrendercommandencoder/executecommandsinbuffer(_:range:).md)
