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

# MTLIndirectComputeCommand

A compute command in an indirect command buffer.

```
protocol MTLIndirectComputeCommand : NSObjectProtocol
```

## Overview

Don’t implement this protocol; you get instances of this type by asking an [`MTLIndirectCommandBuffer`](/documentation/Metal/MTLIndirectCommandBuffer) for them.

Use this instance to reset or encode a command. You need to reset a command before encoding a new command.

## Topics

### Setting a command’s arguments

[`setComputePipelineState(_:)`](/documentation/Metal/MTLIndirectComputeCommand/setComputePipelineState(_:))

Sets the command’s compute pipeline state.

[`setImageblockWidth(_:height:)`](/documentation/Metal/MTLIndirectComputeCommand/setImageblockWidth(_:height:))

Sets the size, in pixels, of the imageblock.

[`setKernelBuffer(_:offset:at:)`](/documentation/Metal/MTLIndirectComputeCommand/setKernelBuffer(_:offset:at:))

Sets a buffer for the compute function.

[`setThreadgroupMemoryLength(_:index:)`](/documentation/Metal/MTLIndirectComputeCommand/setThreadgroupMemoryLength(_:index:))

Sets the size of a block of threadgroup memory.

[`setThreadgroupMemoryLength(_:at:)`](/documentation/Metal/MTLIndirectComputeCommand/setThreadgroupMemoryLength(_:at:))

Sets the size of a block of threadgroup memory.

[`setStageInRegion(_:)`](/documentation/Metal/MTLIndirectComputeCommand/setStageInRegion(_:))

Sets the region of the stage-in attributes to apply to the compute kernel.

[`setStageIn(_:)`](/documentation/Metal/MTLIndirectComputeCommand/setStageIn(_:))

Sets the region of the stage-in attributes to apply to the compute kernel.

### Synchronizing command execution

[`setBarrier()`](/documentation/Metal/MTLIndirectComputeCommand/setBarrier())

Adds a barrier to ensure that commands executed prior to this command are complete before this command executes.

[`clearBarrier()`](/documentation/Metal/MTLIndirectComputeCommand/clearBarrier())

Removes any barrier set on the command.

### Encoding a compute command

[`concurrentDispatchThreadgroups(_:threadsPerThreadgroup:)`](/documentation/Metal/MTLIndirectComputeCommand/concurrentDispatchThreadgroups(_:threadsPerThreadgroup:))

Encodes a compute command using a grid aligned to threadgroup boundaries.

[`concurrentDispatchThreads(_:threadsPerThreadgroup:)`](/documentation/Metal/MTLIndirectComputeCommand/concurrentDispatchThreads(_:threadsPerThreadgroup:))

Encodes a compute command using an arbitrarily sized grid.

### Resetting a command

[`reset()`](/documentation/Metal/MTLIndirectComputeCommand/reset())

Resets the command to its 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)