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 - Result
[true,true]
Example 2vec2b(true, true)
truetrue - Result
[true,true]
Example 3vec2b(false)
falsefalse - 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.
Related functions
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(): vec2bdeclare function vec2b(x: bool, y: bool): vec2bdeclare function vec2b(scalar: bool): vec2bdeclare function vec2b(v: vec2b): vec2bdeclare function vec2b(v: vec2): vec2bdeclare function vec2b(v: vec2i): vec2bdeclare function vec2b(v: vec2u): vec2bParameters
Return value
vec2b
Description
A comparison of two vec2 values yields one.