043 · WGSL
WebGPU Shading Language · eadem ubique
Project Lavos · The Stack
PLATE XLIII · LIVE COMPUTE

Eadem ubique.

— THE SAME EVERYWHERE —

the kernel.

W3C GPU  ·  Google  ·  Apple  ·  Mozilla  ·  2018 — 2023

WGSL · WEBGPU · COMPUTE-CLASS · TRANSLATES TO SPIR-V · MSL · HLSL · NAGA

OSL describes a surface and lets the renderer ask questions. WGSL doesn't describe — it computes. A WGSL compute shader is a kernel: a function dispatched in parallel across thousands of GPU threads. The same kernel runs on Vulkan, Metal, DirectX, and the browser — translated through SPIR-V, MSL, HLSL, and naga IR. The shader is the same everywhere. Below: a kernel running live on this page.

— Plate XLIII · Reaction-Diffusion · live, in your browser — @compute · @workgroup_size(8, 8)
256 × 128 · GRID
@compute · live
gray-scott · feed 0.055 · kill 0.062
→ patterns emerge
— Workgroup — 8 × 8 · 64 threads
— Dispatched — 32 × 16 · per tick
— Per Frame — ~12 ticks · steady state
— Translates To — SPIR-V · MSL · HLSL
// the entire kernel — one function, dispatched in parallel

@compute @workgroup_size(8, 8)
fn step(@builtin(global_invocation_id) id : vec3u) {
  let p = vec2i(i32(id.x), i32(id.y));
  let uv = sample(p);
  let lap = laplacian(p);
  let r = uv.r * uv.g * uv.g;
  state[index(p)] = vec2f(uv.r + (Du*lap.r - r + feed*(1.0 - uv.r))*dt,
                       uv.g + (Dv*lap.g + r - (feed + kill)*uv.g)*dt);
}
— One Source · Four Targets · The Translation Surface — same kernel, every device, no rewrite
SOURCE .wgsl one shader SPIR-V Vulkan · Linux · Android MSL Metal · macOS · iOS HLSL DirectX · Windows · Xbox naga IR browser · WebGPU runtime TINT · NAGA cross-compiler — one source · the compiler decides the backend · the kernel is unchanged —
4 BACKENDS · 1 LANGUAGE safety, portability, parallelism — and no undefined behavior

The promise is portability with safety. No undefined behavior, no out-of-bounds reads, no uninitialized memory — the spec forbids all three. The browser is the harshest sandbox, and WGSL is the first shader language designed to live in it.

OSL was for offline path tracers asking three questions of a closure. WGSL is for real-time compute asking one question, in parallel, of every cell at once.

Authorship & Provenance colophon — W3C GPU for the Web
Authorship
W3C GPU for the Web
Google · Apple · Mozilla · Microsoft · Intel
v1 spec ratified 2023
w3.org/TR/WGSL
Architecture
Strongly typed · safety-first
compute · vertex · fragment stages
cross-compiles to SPIR-V · MSL · HLSL
tint (Google) · naga (Mozilla)
Status
WebGPU stable: Chrome · Edge · 2023
Safari Tech Preview · 2024
Firefox · behind flag
~70% global browser support · 2026

— Lineage · the same everywhere —

2017Apple proposes WebGPU at Khronos. The web has WebGL but it's a thin wrapper over a 2010 desktop API.
2018W3C GPU for the Web Community Group forms. Apple, Google, Mozilla, Microsoft agree: a new shading language is needed.
2020Initial WGSL drafts. "WebGPU Shading Language." Designed for portability — must compile to SPIR-V (Vulkan), MSL (Metal), HLSL (DirectX).
2022WGSL spec freezes. Origin trial in Chrome. First production WebGPU apps ship.
2023WebGPU stable in Chrome 113. WGSL ratified. WebGL's successor lands.
2024Safari ships WebGPU in Tech Preview. Firefox enables behind flag. Mobile WebGPU lands on Android Chrome.
2025+WebGPU compute hits ~70% global browser support. Three.js WebGPURenderer matures. ML-in-the-browser becomes routine via WGSL kernels.
Eadem ubique. One kernel. Every machine. The translation surface is the language.

every machine. the same kernel.

Browser-class compute. Portable across four backends without rewriting a line. The shader is the kernel; the kernel is the same; the translation is the spec.

— § II · Shading · Compute / Browser —
Plate XLIII · MMXXVI
projectlavos-bauhaus · 043