Indirect Command Buffers

Recoup encoding time by reusing commands, or create a GPU-driven rendering pipeline by generating commands on the GPU.

Topics

Essentials

Creating an Indirect Command Buffer

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

MTLIndirectCommandBufferDescriptor

An object that configures new MTLIndirectCommandBuffer objects.

MTLIndirectCommandBuffer

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

MTLIndirectRenderCommand

A render command in an indirect command buffer.

MTLIndirectComputeCommand

A compute command in an indirect command buffer.

MTLIndirectCommandBufferExecutionRange

A range of commands in an indirect command buffer.

MTLIndirectCommandBufferExecutionRangeMake

Creates a command execution range.

Learning from Samples

Encoding Indirect Command Buffers on the CPU

Reduce CPU overhead and simplify your command execution by reusing commands.

Encoding Indirect Command Buffers on the GPU

Maximize CPU to GPU parallelization by generating render commands on the GPU.

See Also

Resources

Setting Resource Storage Modes

Set a storage mode that defines the memory location and access permissions of a resource.

Copying Data to a Private Resource

Use a blit command encoder to copy buffer or texture data to a private resource.

Synchronizing a Managed Resource

Synchronize the contents of a managed resource for the CPU or GPU.

Transferring Data Between Connected GPUs

Use high-speed connections between GPUs to transfer data quickly.

Reducing the Memory Footprint of Metal Apps

Learn best practices for using memory efficiently in iOS and tvOS.

MTLResource

An allocation of memory that is accessible to a GPU.

MTLBlitCommandEncoder

An encoder that encodes memory copying, filtering, and fill commands.

MTLResourceStateCommandEncoder

An encoder that encodes commands that modify resource configurations.

Buffers

Create and manipulate unstructured GPU resources.

Textures

Create and manipulate structured GPU resources.

Heaps

Create a single allocation of memory from which you can suballocate resources.

Synchronization

Manage access to resources in your app to avoid data hazards.