Contents

barrier(afterEncoderStages:beforeEncoderStages:visibilityOptions:)

Encodes an intra-pass barrier.

Declaration

func barrier(afterEncoderStages: MTLStages, beforeEncoderStages: MTLStages, visibilityOptions: MTL4VisibilityOptions = [ .device ])

Parameters

  • afterEncoderStages:

    Mtlstages mask that represents the stages of work to wait for. This argument only applies to subsequent work you encode in the current command encoder.

  • beforeEncoderStages:

    Mtlstages mask that represents the stages of work that wait. This argument only applies to work you encode in the current command encoder prior to this barrier.

  • visibilityOptions:

    Mtl4visibilityoptions of the barrier, controlling cache flush behavior.

Mentioned in

Discussion

Encode a barrier that guarantees that any subsequent work you encode in the current command encoder, corresponding to beforeEncoderStages, doesn’t begin until all prior commands in this command encoder, corresponding to afterEncoderStages, completes.

When calling this method, it’s your responsibility to ensure parameters afterEncoderStages and beforeEncoderStages contain a combination of MTLStages for which this encoder can encode commands. For example, for a MTL4ComputeCommandEncoder instance, you can provide any combination of dispatch, blit and accelerationStructure.