Function spirv_std::arch::control_barrier

source ·
pub unsafe fn control_barrier<const EXECUTION: u32, const MEMORY: u32, const SEMANTICS: u32>(
)
Expand description

Wait for other invocations of this module to reach the current point of execution.

All invocations of this module within Execution scope reach this point of execution before any invocation proceeds beyond it.

When Execution is crate::memory::Scope::Workgroup or larger, behavior is undefined unless all invocations within Execution execute the same dynamic instance of this instruction. When Execution is Subgroup or Invocation, the behavior of this instruction in non-uniform control flow is defined by the client API.

If crate::memory::Semantics is not crate::memory::Semantics::NONE, this instruction also serves as an memory_barrier function call, and also performs and adheres to the description and semantics of an memory_barrier function with the same MEMORY and SEMANTICS operands. This allows atomically specifying both a control barrier and a memory barrier (that is, without needing two instructions). If crate::memory::Semantics is crate::memory::Semantics::NONE, MEMORY is ignored.

Before SPIRV-V version 1.3, it is only valid to use this instruction with TessellationControl, GLCompute, or Kernel execution models. There is no such restriction starting with version 1.3.

If used with the TessellationControl execution model, it also implicitly synchronizes the output storage class: Writes to output variables performed by any invocation executed prior to a control_barrier are visible to any other invocation proceeding beyond that control_barrier.