Core guide

WebGPU runtime

Create a secure-context WebGPU renderer and draw deterministic frames.

Live example

See WebGPU runtime in action

See the production WebGPU renderer create a surface and draw a frame.

live rendering loading ticks 0

How it works

The renderer owns the adapter, device, canvas context, pipelines, textures, samplers, and readback path. Device loss is reported as a typed game error.

Public types

  • WebGpuRenderer
  • WebGpuRendererOptions
  • RenderFrame
  • WebGpuUnavailableError
  • GameDeviceLostError

Minimum viable example

typescript
const renderer = await create_webgpu_renderer({ canvas, width: 800, height: 450 });
const frame = renderer.begin_frame();
frame.draw_commands([{ kind: "rectangle", draw: { rectangle: { x: 0, y: 0, width: 800, height: 450 }, color: { red: 0, green: 0, blue: 0, alpha: 1 } } }]);
await frame.submit();
renderer.dispose();

Scope and limitations

Render targets and constrained texture fragment effects are available; arbitrary GPU resource APIs remain deferred.