Contents

wait(for:)

Encodes a command that instructs the GPU to pause before starting the resource state commands until another pass updates a fence.

Declaration

func wait(for fence: any MTLFence)
optional func wait(for fence: any MTLFence)

Parameters

  • fence:

    An Mtlfence instance to pause execution on until updated.

Discussion

Fences maintain order to prevent GPU data hazards as the GPU runs various passes within the same command queue. The encoded resource state commands wait for a pass to update fence before running.

The GPU driver evaluates the fences that apply to the pass and the commands that depend on those fences when your app commits the enclosing MTLCommandBuffer.

See Also

Performing fence operations