all
On this page

all

Function

All is true when every component of a boolean or a boolean vector is true.

Compare examples

The result is true only when every component is true. One false component makes it false.

Example 1all(vec2b(false, false))
falsefalse
Components in this example
Result
false
Example 2all(vec2b(false, true))
falsetrue
Components in this example
Result
false
Example 3all(vec2b(true, true))
truetrue
Components in this example
Result
true

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 for checking whether every value is valid.

Inputs and limits

A per-component comparison creates a boolean vector; all reduces it to a single boolean.

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

WGSL
all(a)
GLSL ES 3.00
all(a)

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

Whether every component of a vector of bools is true: all(a === b).

Syntax

declare function all(a0: bool): bool
declare function all<V extends vec2b | vec3b | vec4b>(a0: V): (bool)
declare function all(v: bool | BoolVec): bool

A signature may name a type the ambient file declares for its own use. These are those declarations.

BoolVec
type BoolVec = vec2b | vec3b | vec4b

Parameters

Return value

bool(bool)

Description

A scalar bool passes through. Over an array, write xs.every((x) => ...).

Targets

WGSL
all(a)
GLSL ES 3.00
all(a)

Examples

See also

Edit this page Report a problem