u32()
Function in Values
A u32 literal node.
import { u32 } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
function u32(v: number): Node<'u32'>;function u32(x: ReadonlyNode<ScalarCastSource>): Node<'u32'>;Parameters
vnumber
Return value
Node<'u32'>
Exceptions
Description
Use it over the f32 default wherever WGSL demands an unsigned scalar:
buffer strides, vertex and instance indices, bit-flag masks used with .bitAnd and .bitOr.
A Node argument is a cast instead: u32(x) converts, the free-function twin of x.u32().
It builds what toU32 builds, and its operand is bounded to a scalar.
Examples
Example
import { u32 } from 'typeshade'
const flags = u32(4) // Node<'u32'>Targets
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Supported |
|
| GLSL ES 3.00 (WebGL2) | Supported |
|
| CPU oracle | Supported | Evaluated in f64 by the oracle. |
In the guide
See also
Source
src/core/ir/node.ts, line 1019, at commit 26de7be8