Types
A type is written where WGSL writes one, on a declaration, a parameter, a field and a return. The element type rides inside the name where WGSL takes a type argument, so vec3<u32> is vec3u and there is nothing in angle brackets to get wrong.
Scalars
f32f32i32i32u32u32boolboolf16No type name in this surface. "enable f16" beside "use typeshade" emits WGSL's enable f16;, and the reflection names the capability a host requests as shader-f16, but there is still no f16 to declare a value with.
WGSL has no 64-bit float. The pass below rewrites the declaration before the writer sees it.
f64A double has no WGSL type behind it. The declaration is written f64, and a pass rewrites every one into a pair of f32 lanes and a library of functions over them before the writer runs. A multiplication of two doubles reaches the WGSL as one call.
let d = df64_mul(vec2<f32>(uv.x, 0.0), vec2<f32>(u.a, 0.0), _fp64_g);Vectors
vec3<f32>vec3vec3<f32>vec3fvec3<u32>vec3uvec3<i32>vec3ivec3<bool>vec3bWGSL has no 64-bit vector either, and the same pass rewrites this one.
vec3dvec2 and vec4 read the same way as the three above. vec3 and vec3f are one type, and so are vec3d and vec3f64.
Matrices
mat2x2<f32>mat2x2mat2x3<f32>mat2x3mat2x4<f32>mat2x4mat3x2<f32>mat3x2mat3x3<f32>mat3x3mat3x4<f32>mat3x4mat4x2<f32>mat4x2mat4x3<f32>mat4x3mat4x4<f32>mat4x4A square matrix also answers to the short name both targets give it, so mat4 and mat4x4 are the same declaration. The C and the R mean what they mean in WGSL, columns then rows.
Arrays and atomics
array<f32, 4>array<f32, 4>array<f32, 2>[f32, f32]array<f32>array<f32>atomic<u32>atomic<u32>atomic<i32>atomic<i32>A tuple is a list of a length the type fixes, which is what an array of a known size is, so [f32, f32] and array<f32, 2> reach the same type. A runtime-sized array and an atomic each live in a storage binding.
Textures and samplers
texture_2d<f32>texture_2d<f32>texture_2d_array<f32>texture_2d_array<f32>texture_cube<f32>texture_cube<f32>texture_3d<f32>texture_3d<f32>texture_1d<f32>texture_1d<f32>texture_cube_array<f32>texture_cube_array<f32>texture_multisampled_2d<f32>texture_multisampled_2d<f32>texture_storage_2d<rgba8unorm, write>texture_storage_2d<"rgba8unorm", "write">texture_storage_2d_array<rgba8unorm, write>texture_storage_2d_array<"rgba8unorm", "write">texture_depth_2dtexture_depth_2dtexture_depth_2d_arraytexture_depth_2d_arraytexture_depth_cubetexture_depth_cubetexture_depth_cube_arraytexture_depth_cube_arraytexture_depth_multisampled_2dtexture_depth_multisampled_2dsamplersamplersampler_comparisonsampler_comparisontexture_2d<u32>texture_2d<u32>texture_2d<i32>texture_2d<i32>A texture and a sampler are written bare, with no address-space wrapper, because a handle lives in no address space. A sampled texture takes f32, i32 or u32, and the element decides both the WGSL spelling and which reads apply to it. A storage texture takes a format and an access mode as string literal types, which tsc checks before this compiler does.