Article

Creating an Indirect Command Buffer

Configure a descriptor to specify the properties of an indirect command buffer.

Overview

An indirect command buffer stores encoded GPU commands persistently. Using an indirect command buffer, you can encode a command once and reuse it multiple times. You can also encode commands into an indirect command buffer simultaneously with multiple threads on the CPU or with a compute kernel on the GPU.

To create an indirect command buffer, first create a MTLIndirectCommandBufferDescriptor object and configure the descriptor’s properties. Then call makeIndirectCommandBuffer(descriptor:maxCommandCount:options:) on a MTLDevice object to create the indirect command buffer.

See Also

Essentials

protocol MTLIndirectCommandBuffer

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

protocol MTLIndirectRenderCommand

A render command in an indirect command buffer.

protocol MTLIndirectComputeCommand

A compute command in an indirect command buffer.

struct MTLIndirectCommandBufferExecutionRange

A range of commands in an indirect command buffer.