---
title: "executeCommandsInBuffer:withRange:"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlcomputecommandencoder/executecommandsinbuffer:withrange:"
---

# executeCommandsInBuffer:withRange:

Encodes an instruction to run commands from an indirect buffer.

## Declaration

```occ
- (void) executeCommandsInBuffer:(id<MTLIndirectCommandBuffer>) indirectCommandBuffer withRange:(NSRange) executionRange;
```

## Parameters

- `indirectCommandBuffer`: The doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBuffer instance containing the commands to execute.
- `executionRange`: The range of commands to execute. The maximum length of the range is 16384 commands.

## See Also

### Dispatching from indirect command buffers

- [dispatchThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerThreadgroup:)](metal/mtlcomputecommandencoder/dispatchthreadgroups(indirectbuffer:indirectbufferoffset:threadsperthreadgroup:).md)
- [executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:](metal/mtlcomputecommandencoder/executecommandsinbuffer:indirectbuffer:indirectbufferoffset:.md)
