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

# executeCommandsInBuffer(_:range:)

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

## Declaration

```swift
func executeCommandsInBuffer(_ buffer: any MTLIndirectCommandBuffer, range: Range<Int>)
```

## Parameters

- `buffer`: An doc://com.apple.metal/documentation/Metal/MTLIndirectCommandBuffer instance that contains other commands the current command runs.
- `range`: A span of integers that represent the command entries in buffer the current command runs. When running on Metal devices that belong to the doc://com.apple.metal/documentation/Metal/MTLGPUFamily/mac2 GPU family, the number of commands needs to be less than or equal to 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.

## See Also

### Running commands from indirect command buffers

- [executeCommandsInBuffer(_:indirectBuffer:offset:)](metal/mtlrendercommandencoder/executecommandsinbuffer(_:indirectbuffer:offset:).md)
