Hi! Sharing a small demo project using wasi:webgpu from a JS host (FYI).
Repository: https://github.com/ritalin/egui-wasi-webgpu-demo
Online demo: https://ritalin.github.io/egui-wasi-webgpu-demo/
WASM is transpiled to JavaScript using @bytecodealliance/jco
Tested on Chrome 145 on MacOS Ventura.
What this demo shows
GPUDevicePipeline:
egui (WASM layout) -> paint commands -> wasi:webgpu calls -> JS shim -> real WebGPU
Limitations
as unknown as RenderContext
This appears to be due to TypeScript type incompatibilities between generated bindings and host shim types.
Hope this is useful as a reference for a JS-hosted wasi:webgpu workflow.
fun!!!!
Really cool @ktz_alias !!
Curious, how did you get egui to render to webgpu directly?
Also, seems like you implemented a browser shim from scratch. I've been working on https://github.com/wasi-gfx/wasi-gfx-shim, maybe it's worth collaborating
@Mendy Berger I used egui-wgpu as the reference beacause of implementing a renderer. (I've used a egui's shader)
seems like you implemented a browser shim from scratch.
Yes! Firstry, I've created boilerplate codes from the jco transpile output, using a rust swc crate, then I implemented in the WebGPU call.
I didn't realize https://github.com/wasi-gfx/wasi-gfx-shim repository.
Last updated: Mar 23 2026 at 16:19 UTC