subgroupAll
On this page

subgroupAll

Function

A vote gives every lane true when every lane's bool is true.

Compare examples

The fixture has one false lane, so the vote is false. On one lane the vote is the lane's own bool.

Model assumptionssubgroup of 4 lanes; x = [3, 1, 4, 1]; p = [true, false, true, true]

Example 1subgroupAll(p)
Result
false in every lane
Example 2subgroupAll(p)
Result
one lane (WebGL2, CPU oracle): p

The examples are calculation models and do not run GPU work. The reference below gives the complete call signatures. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

When to use it

Use it to take a branch only when the whole subgroup agrees, such as skipping work every lane would skip.

Inputs and limits

Every lane must reach the call together, so the call cannot sit under a condition that differs by lane.

For shader input rules and precision, consult WGSL and GLSL ES 3.00.

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

Returns true when e is true in every lane of the subgroup.

Syntax

declare function subgroupAll(a0: bool): bool

Parameters

A parameter named by position (a0, a1) carries a name the ambient file generates. A call passes its arguments in order and names none of them.

Return value

bool

Description

On the CPU oracle and on WebGL2 a subgroup is one invocation (Rule 11.21), so it gives the lane's own value.

Targets

WGSL
subgroupAll(a)
GLSL ES 3.00
subgroupAll is lowered to one lane before the GLSL writer runs (Rule 11.21)

See also

Edit this page Report a problem