Contents

executeCommands(buffer:indirectBuffer:)

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

Declaration

func executeCommands(buffer indirectCommandBuffer: any MTLIndirectCommandBuffer, indirectBuffer indirectRangeBuffer: MTLGPUAddress)

Parameters

Discussion

Use this method to indicate to Metal the span of indices in the command buffer to execute indirectly via an MTLBuffer instance you provide in the indirectRangeBuffer parameter. This allows you to calculate the span of commands Metal executes in the GPU timeline, enabling GPU-driven workflows.

Metal requires that the contents of this buffer match the layout of struct MTLIndirectCommandBufferExecutionRange, which specifies a location and a length within the indirect command buffer. You are responsible for ensuring the address of this buffer has 4-byte alignment.

Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectRangeBuffer parameter references.

See Also

Running commands from indirect command buffers