SYSTEM Cited by 1 source
WGSL¶
WGSL (WebGPU Shading Language) is the shading language defined by the WebGPU specification. All WebGPU shader code must be WGSL — it's the only shader language WebGPU APIs accept.
WGSL is a new language, not a dialect of GLSL or HLSL. It borrows syntactic ideas from Rust (explicit type annotations, attributes, pipelined semantics), but is its own spec maintained at W3C.
Differences from WebGL 1 GLSL (relevant to migration)¶
- Uniform blocks required. Individual uniform declarations from WebGL 1 GLSL don't translate; uniforms must be grouped into explicit blocks. See concepts/uniform-buffer.
- Explicit binding / group decorators. Each resource in a shader
must declare its
@binding(n) @group(n)slot. - Type-first syntax —
var<uniform> x: vec3frather than GLSL'suniform vec3 x. - Enforced struct layouts for buffer-backed data.
These differences are why a migrating codebase with WebGL 1 GLSL shaders can't just do naïve text translation — the source language often needs to be upgraded to a newer GLSL version first, then handed to a translator like naga.
Seen in¶
- sources/2026-04-21-figma-rendering-powered-by-webgpu — target language of Figma's shader translation pipeline; emitted from normalized newer-GLSL by naga.