Creative Coding

WebGPU made browser graphics feel serious

2 min read

Chrome 113 shipping WebGPU made the browser a credible place to learn GPU-shaped thinking.

The API is explicit about adapters, devices, buffers, pipelines, shaders, command encoders, and resource setup:

const adapter = await navigator.gpu.requestAdapter()
const device = await adapter?.requestDevice()

The page is mediating access to hardware. That is a useful lesson in itself.

Rendering makes the setup concrete:

const context = canvas.getContext("webgpu")
const format = navigator.gpu.getPreferredCanvasFormat()

context?.configure({
  device,
  format,
})

The program creates a pipeline, records commands, and submits work to a queue. You do not merely draw a rectangle; you describe resources and work explicitly.

WGSL keeps shader learning close to the web platform:

@vertex
fn vertexMain(@location(0) position: vec2f) -> @builtin(position) vec4f {
  return vec4f(position, 0.0, 1.0);
}

@fragment
fn fragmentMain() -> @location(0) vec4f {
  return vec4f(0.1, 0.4, 0.9, 1.0);
}

Performance becomes inspectable too. Ask whether buffers are recreated, pipelines built during interaction, transfers crossing the CPU/GPU boundary, commands batched, or shaders doing too much per fragment.

Portability remains part of the contract. Limits, features, memory, and thermal behavior differ across devices:

if (!navigator.gpu) {
  renderStaticPreview()
} else {
  await renderWebGpuExperience()
}

That fallback is an honest product decision, not a failure.

WebGPU made heavier experiments practical in a browser: particle fields, procedural textures, simulations, and visual explanations beside prose and controls. It made browser graphics feel serious by exposing serious concepts.

Jeremy London

About Jeremy London

Engineering leader and builder in Denver. I write about AI platforms, agents, security, reliability, homelab infrastructure, and the parts of engineering work that have to survive production.