Skip to content

Instantly share code, notes, and snippets.

@pollend
Created August 21, 2026 04:10
Show Gist options
  • Select an option

  • Save pollend/3b0a22f11db58ab7fae7cb473d190d05 to your computer and use it in GitHub Desktop.

Select an option

Save pollend/3b0a22f11db58ab7fae7cb473d190d05 to your computer and use it in GitHub Desktop.
Get it running
1. Build
cd ~/projects/rhi-zig/examples
zig build -Dtarget=wasm32-freestanding
2. Serve (WebGPU needs a secure context — file:// won't work, localhost counts)
cd zig-out/bin && python3 -m http.server 8000
3. Launch Chrome with WebGPU enabled
google-chrome --enable-unsafe-webgpu http://localhost:8000/00_clear.html
Or persistently: chrome://flags/#enable-unsafe-webgpu → Enabled → relaunch.
Why it failed
Chrome 151 on Linux still gates WebGPU behind that flag. I confirmed it directly on your machine — same page, same build:
┌────────────────────────┬───────────────────┐
│ Flags │ requestAdapter() │
├────────────────────────┼───────────────────┤
│ none │ null ← your error │
├────────────────────────┼───────────────────┤
│ --enable-unsafe-webgpu │ adapter OK │
└────────────────────────┴───────────────────┘
Your GPU is fine (RX 7800 XT, RADV, Vulkan 1.4.335). Firefox needs dom.webgpu.enabled in about:config instead.
One thing I have not verified — don't assume it renders yet
With the flag, I confirmed on your hardware: adapter ✓, device ✓, glue loads ✓, wasm instantiates ✓, boot() resolves ✓, rAF frames run ✓, and zero WGSL or pipeline-validation errors from Chrome — so the Slang→WGSL output and both render pipelines are valid on a real implementation.
But when I read the canvas pixels back, it was entirely black — 00_clear should be rgb(26,51,102). No console errors, no WebGPU validation complaints. So work is submitted and accepted, yet nothing reaches the canvas.
That's either a real bug in my frame path (likely candidates: the surface-configure/getCurrentTexture handshake, or the swapchain-rebuild path when the initial size is 0) or an artifact of reading pixels from a headless/occluded window. I was mid-investigation — adding call counters to the glue to find which stage isn't running — when you interrupted.
So: open it yourself and tell me what you see. If it's black for you too, I'll finish tracking it down; if it renders, the black readback was my measurement artifact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment