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

# executeCommandsInBuffer(_:indirectBuffer:offset:)

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

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

## Parameters

`buffer`

An [`MTLIndirectCommandBuffer`](/documentation/Metal/MTLIndirectCommandBuffer) instance that contains other commands the current command runs.

`indirectRangeBuffer`

An [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance with data that matches the layout of the [`MTLIndirectCommandBufferExecutionRange`](/documentation/Metal/MTLIndirectCommandBufferExecutionRange) structure.

    When running on Metal devices that belong to the [`MTLGPUFamily.mac2`](/documentation/Metal/MTLGPUFamily/mac2)     GPU family, the maximum value for the [`length`](/documentation/Metal/MTLIndirectCommandBufferExecutionRange/length)     property of that structure is 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.

`offset`

An integer that represents the location, in bytes, from the start of `indirectRangeBuffer` where the execution range structure begins.

    See the     [Metal feature set tables (PDF)](https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf)     to check for offset alignment requirements for buffers in     `device`     and     `constant`     address space.

---

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)