<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLIndirectCommandBuffer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIndirectCommandBuffer"
  },
  "title" : "MTLIndirectCommandBuffer"
}
-->

# MTLIndirectCommandBuffer

A command buffer containing reusable commands, encoded either on the CPU or GPU.

```
protocol MTLIndirectCommandBuffer : MTLResource
```

## Overview

Use an indirect command buffer to encode commands once and reuse them, and to encode commands on multiple CPU or GPU threads.

Don’t implement this protocol yourself; instead, create an [`MTLIndirectCommandBufferDescriptor`](/documentation/Metal/MTLIndirectCommandBufferDescriptor) instance, configure its properties, and tell the [`MTLDevice`](/documentation/Metal/MTLDevice) to create the indirect command buffer. See [Creating an indirect command buffer](/documentation/Metal/creating-an-indirect-command-buffer).

## Topics

### Determining the maximum number of commands

[`size`](/documentation/Metal/MTLIndirectCommandBuffer/size)

The number of commands contained in the indirect command buffer.

### Retrieving commands

[`indirectRenderCommandAt(_:)`](/documentation/Metal/MTLIndirectCommandBuffer/indirectRenderCommandAt(_:))

Gets the render command at the given index.

[`indirectComputeCommandAt(_:)`](/documentation/Metal/MTLIndirectCommandBuffer/indirectComputeCommandAt(_:))

Gets the compute command at the given index.

[`indirectComputeCommand(at:)`](/documentation/Metal/MTLIndirectCommandBuffer/indirectComputeCommand(at:))

Gets the compute command at the given index.

### Resetting commands

[`reset(_:)`](/documentation/Metal/MTLIndirectCommandBuffer/reset(_:))

Resets a range of commands to their default state.

[`resetWithRange:`](/documentation/Metal/MTLIndirectCommandBuffer/resetWithRange:)

Resets a range of commands to their default state.



---

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)