vec2b
On this page

vec2b

Function

vec2b groups 2 components into a vector. A single scalar broadcasts to every component.

Compare examples

Compare a broadcast with distinct components and a zero value. Each component retains its position.

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

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 vectors to represent coordinates, directions, colours, or several independent values of the same type.

Inputs and limits

A constructor does not normalize a direction. Integer, boolean, and floating-point vectors have different component types; this compiler emulates f64 vectors in software.

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.

Builds a vec2b from two bool scalars, broadcasts a single bool, or converts from a vec2 of a different element kind (nonzero is true).

Syntax

declare function vec2b(): vec2b
declare function vec2b(x: bool, y: bool): vec2b
declare function vec2b(scalar: bool): vec2b
declare function vec2b(v: vec2b): vec2b
declare function vec2b(v: vec2): vec2b
declare function vec2b(v: vec2i): vec2b
declare function vec2b(v: vec2u): vec2b

Parameters

Return value

vec2b

Description

A comparison of two vec2 values yields one.

See also

Edit this page Report a problem