<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4RenderCommandEncoder/executeCommandsInBuffer:withRange:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4RenderCommandEncoder(im)executeCommandsInBuffer:withRange:"
  },
  "title" : "executeCommandsInBuffer:withRange:"
}
-->

# executeCommandsInBuffer:withRange:

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

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

## Parameters

`indirectCommandBuffer`

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

`executionRange`

A span of integers that represent the command entries in the buffer that the current command runs.

## Discussion

Use this method to encode the execution of a range of Metal render commands in the GPU timeline.

> Note: if the `indirectCommandBuffer` parameter references any pipeline state objects, you are responsible
> for adding them to a ``doc://com.apple.metal/documentation/Metal/MTLResidencySet`` instance in use when you commit the command buffer.
> 
> An indirect render command references a pipeline state when you pass it as an argument to the
> command’s ``doc://com.apple.metal/documentation/Metal/MTLIndirectRenderCommand/setRenderPipelineState(_:)`` method during CPU encoding, or
> `set_render_pipeline_state()` during GPU encoding.

---

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)