<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/executeCommandsInBuffer(_:range:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So23MTLRenderCommandEncoderP5MetalE23executeCommandsInBuffer_5rangeySo011MTLIndirectbH0_p_SnySiGtF"
  },
  "title" : "executeCommandsInBuffer(_:range:)"
}
-->

# executeCommandsInBuffer(_:range:)

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

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

## Parameters

`buffer`

An [`MTLIndirectCommandBuffer`](/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 [`MTLGPUFamily.mac2`](/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 [`MTLGPUFamily.apple10`](/documentation/Metal/MTLGPUFamily/apple10), don’t have this limitation.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)