@const built-ins
All the WGSL built-in functions
annotated with @const
can be evaluated at
shader creation time.
When a call to such a function has only constant-expression arguments, then the call itself is a constant-expression.
All the WGSL built-in functions
annotated with @const
can be evaluated at
shader creation time.
When a call to such a function has only constant-expression arguments, then the call itself is a constant-expression.
const angle_deg = 30; // radians() is annotated with @const, so it can be used // in a constant-expression. const angle_rad = radians(angle_deg);