Types

Types

85 members

The type keys and type descriptors the authoring surface is typed by.

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

ALL_STORAGE_TEXTURE_FORMATS Constant
Every StorageTextureFormat, as a runtime value: the list a front end validates a written name against and a doc generator iterates.
ArithArg Type
The operand a binary arithmetic method accepts for a receiver of key K.
ArrayElemKey Type
Element key of an array key: array<f32,4> → 'f32', array<vec3<f32>> → 'vec3<f32>', and never for a key that is not an array.
arrayT Function
Builds the ShaderType for an array.
atomicI32T Constant
atomic<i32>: the signed twin of atomicU32T.
atomicU32T Constant
atomic<u32>: an unsigned 32-bit integer in storage memory that many invocations update at once through the atomic* builtins.
boolT Constant
The bool scalar type: the type of every comparison and logical (.and, .or) result, the required return type of a boolean-returning fn, and the type an If(/api/if/) condition is checked against when the authoring code runs.
CAS_RESULT_STRUCTS Constant
The struct atomicCompareExchangeWeak answers: the contents the location held before the call, and whether the exchange happened.
casResultT Function
The CAS_RESULT_STRUCTS type for one atomic element kind.
CmpArg Type
The operand a comparison method accepts for a receiver of key K: the receiver's own scalar kind, since both targets compare matching operands only, plus f32 for an f64 receiver, which widens before the compare.
ElemKey Type
Element key of a vector key; identity for scalars.
f32T Constant
The f32 scalar type, the DSL's default numeric type: what a bare numeric literal lifts to (lift(3) is a Node<'f32'>) and what most builtins return.
f64T Constant
The emulated double-precision scalar type.
Float64Key Type
The emulated-double keys, 'f64' and the f64 vectors.
FloatKey Type
The f32-family keys, 'f32' and the f32 vectors: the argument domain of the float-only component-wise builtins.
i32T Constant
The i32 scalar type, the DSL's signed-integer type: the result type of the i32(/api/i32/) cast, and the type a non-integer matchExpr scrutinee is cast to before emit, since WGSL's switch only accepts integer scrutinees.
IntKey Type
The integer keys, i32 and u32 scalars and vectors, for the builtins whose WGSL and GLSL domain includes integers: abs, min, max and clamp.
isF64 Function
Narrows a ShaderType to the emulated-double scalar arm (f64T).
isMat Function
Narrows a ShaderType to the { kind: 'mat' } arm.
isMat64 Function
Narrows a ShaderType to an emulated-double matrix (matNxN<f64>, see mat2f64T), which is emitted as a struct of double-double columns.
isScalar Function
Narrows a ShaderType to the native { kind: 'scalar' } arm.
isVec Function
Narrows a ShaderType to the native { kind: 'vec' } arm, whose elem is 'f32' | 'i32' | 'u32'.
isVec64 Function
Narrows a ShaderType to the emulated-double vector arm (vec2f64T and its 3- and 4-wide siblings).
KeyOf Type
Turns a ShaderType literal into the precise string key that Node carries as its compile-time phantom: KeyOf<typeof vec3fT> resolves to 'vec3<f32>', so a vec2 and vec3 operand mismatch fails tsc before the runtime SD0002 check in typeKey and typeEq would catch it.
mat2f64T Constant
A 2×2 emulated-double matrix, logically mat2x2<f64>.
mat3f64T Constant
A 3×3 emulated-double matrix; see mat2f64T for how it is emitted and the matrix operations available on it.
mat4f64T Constant
A 4×4 emulated-double matrix; see mat2f64T for how it is emitted and the matrix operations available on it.
mat4x4fT Constant
A native mat4x4<f32>, the model-view-projection or view matrix type of a typical per-frame uniform.
matT Function
Any matCxR<f32> or matCxR<f64>: cols columns of rows components each, column-major as both targets are.
NodeLike Type
Anything accepted where a node is read: any node, mutable or read-only, or a JS number, which lifts to an f32 literal.
NonComposite Type
Maps a composite key to never and passes every other key through.
READ_WRITE_STORAGE_FORMATS Constant
The formats a device takes at read_write access, which is the three single-channel 32-bit ones and no others (measured, as StorageTextureFormat describes).
samplerComparisonT Constant
The comparison sampler textureSampleCompare takes: it compares a reference value against the texel and yields how much of the filter footprint passed, rather than the texel itself.
samplerT Constant
The sampler resource type.
Scalar Type
The four native scalar kinds: the ones WGSL and GLSL ES 3.00 both represent directly in hardware, and the set a ShaderType of kind: 'scalar' can carry.
ScalarCastSource Type
The scalar keys a cast reads: every native scalar, plus the emulated double.
ScalarKey Type
The key form of Scalar without 'bool': the set accepted wherever the DSL needs an indexable or comparable native scalar, such as array indices (.at(i, elem)), bitwise-op operands, and matchExpr or Switch scrutinees.
ShaderType Type
The runtime type descriptor for every value the DSL can represent: a plain, comparable discriminated union, so a switch (t.kind) over it is exhaustively checked by tsc at every site that must decide what to do with a shape (typeKey, wgslLayout, both backends' emit walkers).
storageFormatFeature Function
The device feature a format needs before any device will store to it, or undefined when the format is core.
storageTexel Function
The type of one texel of a storage texture, which its format's channel kind decides: a …uint format loads and stores vec4<u32>, a …sint format vec4<i32>, and every other one vec4<f32>.
StorageTextureAccess Type
How a shader may touch a storage texture.
StorageTextureFormat Type
The texel formats a storage texture may carry, which is WebGPU's set of formats every device supports with STORAGE_BINDING and no optional feature.
storageTextureLayoutAccess Function
What WebGPU's GPUStorageTextureBindingLayout.access calls a WGSL access mode.
structT Function
Builds the ShaderType for a named struct: the type you pass wherever a struct-typed value is authored (a b.var(name, structT('VsOut')) local, an fn parameter, an array element via arrayT).
SwizzleKey Type
The key of v.swizzle(S) for a vector key K: the element scalar when S has one character, otherwise vecN<elem> with N the length of S.
TexelKey Type
The vec4<…> key a texel load from texture key K yields: the loaded element is the element in the texture key, so texture_2d<u32> loads a vec4<u32>.
texture1dfT Constant
A sampled float 1D texture: a row of texels addressed by one f32, the shape a transfer function or a colour ramp takes.
texture2dArrayfT Constant
A sampled 2D array texture: one texture object with N independently addressable layers.
texture2dArrayiT Constant
A signed-integer 2D array texture: the signed twin of texture2dArrayuT.
texture2dArrayuT Constant
An unsigned-integer 2D array texture: texture2dArrayfT's layer model with texture2duT's exact integer texels.
texture2dfT Constant
A sampled 2D float texture: the ordinary single-layer binding type behind textureSample and textureLoad, for colour ramps, lookup tables and atlases (resource).
texture2diT Constant
A signed-integer 2D texture: the signed twin of texture2duT, with the same load-only contract.
texture2dMsfT Constant
A multisampled 2D texture: the resolve-source binding for an MSAA render target, read one sample at a time with textureLoad inside a per-sample averaging loop.
texture2duT Constant
An unsigned-integer 2D texture.
texture3dfT Constant
A sampled float 3D texture: a volume addressed by a vec3 coordinate, the shape a colour-grading lookup table or a density field takes.
textureCubeArrayfT Constant
An array of float cube textures: N environment maps in one binding, looked up by a vec3 direction and a layer.
textureCubefT Constant
A sampled float cube texture: six faces looked up by a vec3 Direction rather than a coordinate, the shape an environment map or a skybox takes.
textureDepth2dArrayT Constant
An array of 2D depth textures, the shape a cascaded shadow map takes.
textureDepth2dT Constant
A 2D depth texture, the texture a shadow map is.
textureDepthCubeArrayT Constant
An array of cube depth textures: the shadow maps of N point lights in one binding.
textureDepthCubeT Constant
A cube depth texture: the shadow map of a point light, compared by the direction from the light.
textureDepthMultisampled2dT Constant
A multisampled depth texture: the depth attachment of an MSAA render target, read one sample at a time with textureLoad and never sampled or compared.
TextureElem Type
The element type of a sampled texture: WGSL's texture_2d<T> type parameter, or GLSL ES 3.00's sampler prefix.
TextureLoad2dKey Type
Every non-array texture key a texel load accepts: the three sampled elements plus the multisampled f32 texture.
TextureLoadArrayKey Type
Every 2D array texture key a texel load accepts.
typeEq Function
Structural equality for ShaderType: two types are equal when their typeKey strings match, so a constant like boolT compares equal to a freshly built { kind: 'scalar', scalar: 'bool' } object even though they are different references.
typeKey Function
The runtime twin of KeyOf: turns any ShaderType value, literal or widened, into its canonical string key.
u32T Constant
The u32 scalar type, the DSL's unsigned-integer type: counts, indices, and the compute and vertex builtins that are unsigned by spec (builtin; the vector form is builtin).
vec2bT Constant
vec2<bool>: what a comparison of two vec2 values yields, componentwise.
vec2f64T Constant
A 2-component emulated-double vector, logically vec2<f64>.
vec2fT Constant
A native vec2<f32>, the most common vector type in the DSL: screen and UV coordinates and 2D positions, such as a uv: location(0, vec2fT) fragment-input field or a resolution: vec2fT uniform.
vec2iT Constant
A native vec2<i32>. Build a value with the vec2i constructor, for example a texel coordinate for textureLoad.
vec2uT Constant
A native vec2<u32>, a 2-wide unsigned-integer field, such as a packed pick-ID varying declared location.
vec3bT Constant
vec3<bool>: the componentwise comparison of two three-component vectors.
vec3f64T Constant
A 3-component emulated-double vector; see vec2f64T for how it is emitted and when to prefer the emulated-double family over plain vec3fT.
vec3fT Constant
A native vec3<f32>, the usual carrier for a world-space position or direction, such as the p: vec3fT parameter of a signed-distance scene function.
vec3iT Constant
A native vec3<i32>, the signed-integer counterpart of vec3uT, a texel coordinate into an array texture, a signed grid cell.
vec3uT Constant
A native vec3<u32>, chiefly the type of the compute global_invocation_id builtin (builtin).
vec4bT Constant
vec4<bool>: the componentwise comparison of two four-component vectors.
vec4f64T Constant
A 4-component emulated-double vector; see vec2f64T for how it is emitted and when to prefer the emulated-double family over plain vec4fT.
vec4fT Constant
A native vec4<f32>: an RGBA colour or a homogeneous clip-space position.
vec4iT Constant
A native vec4<i32>, completing the signed-integer vector family alongside vec2iT.
vec4uT Constant
A native vec4<u32>, a 4-wide unsigned-integer resource or uniform field, such as the parameter block of a compute kernel (resource).
voidT Constant
The absent-value type: the return type of an fn whose body never returns a value.
WRITE_ONLY_STORAGE_FORMATS Constant
The formats a device takes at write and at no other access mode, which today is bgra8unorm alone.

Edit this page Report a problem