---
title: "executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcomputecommandencoder/executecommandsinbuffer:indirectbuffer:indirectbufferoffset:"
---

# executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:

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

## Declaration

```occ
- (void) executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>) indirectCommandbuffer indirectBuffer:(id<MTLBuffer>) indirectRangeBuffer indirectBufferOffset:(NSUInteger) indirectBufferOffset;
```

## 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:withRange:](metal/mtlcomputecommandencoder/executecommandsinbuffer:withrange:.md)
