subgroupAll
Performs a subgroup (wave) boolean vote: returns true only if the predicate is true for all active invocations in the subgroup. It is used as a method: predicate.subgroupAll().
Core Advantages
Enables very cheap cross-invocation boolean reduction (vote) to quickly test subgroup unanimity, allowing early-out, branch pruning, or switching to faster paths.
Common Uses
In fragment/compute stages, check if a condition holds for the entire subgroup to take a uniform lightweight path.
Combine with early discard/early return to avoid expensive sampling or BRDF work.
Debugging or diagnostics: detect divergence within a subgroup.
How to adjust
No tunable parameters; change the input predicate to affect the result. Note: requires underlying subgroup/wave support (e.g., WebGPU or GLSL/HLSL extensions). Provide a fallback when unavailable.
Code Examples
1/* Method-style call: the callee is the implicit argument */
2const isFront = frontFacing; // bool
3const allFront = isFront.subgroupAll(); // true if every lane is front-facing
4
5allFront.cond( /* uniform path */ , /* divergent path */ );