1
2
Fork
You've already forked webgpu-wasm-zig
0
🚀 A minimal WebGPU example written in Zig, compiled to WebAssembly (wasm). 🛠️ Ideal for experimenting and preparing for native development without install dependencies (dawn, wgpu-rs). https://seyhajin.itch.io/webgpu-3d-minimal
  • Zig 86.7%
  • HTML 13.3%
Find a file
2026年01月04日 02:05:59 +01:00
.gitignore using WGPU_DEPTH_SLICE_UNDEFINED, fixing build issues, ignoring zig-cache 2024年11月28日 08:31:09 -08:00
build.zig Update to Emscripten 4.0.22 and Zig 0.15.2 2026年01月04日 02:05:35 +01:00
LICENSE Add LICENSE 2024年01月20日 00:01:33 +01:00
main.zig Update to Emscripten 4.0.22 and Zig 0.15.2 2026年01月04日 02:05:35 +01:00
readme.md Update readme.md 2026年01月04日 02:05:59 +01:00
screen.png Initial commit 2024年01月19日 18:45:18 +01:00
shell.html Attempt to fix issue 2026年01月04日 02:03:29 +01:00

webgpu-wasm-zig

A minimal WebGPU example written in Zig, compiled to WebAssembly (wasm).

👁️

Getting started

Clone

git clone https://github.com/seyhajin/webgpu-wasm-zig.git

Alternatively, download zip from Github repository and extract wherever you want.

Build

Build the example with zig build command, which will generate 3 new files (.html, .js, .wasm).

Command

zig build --sysroot [path/to/emsdk]/upstream/emscripten/cache/sysroot

Example with Emscripten installed with Homebrew (brew install emscripten, v4.0.22) on macOS :

zig build --sysroot /usr/local/opt/emscripten/libexec/cache/sysroot

Or automatically search with brew for the active cellar version :

zig build --sysroot `readlink -f $(brew --prefix emscripten)`/libexec/cache/sysroot

Note

build.zig is preconfigured to build to wasm32-emscripten target only.

Caution

Must provide Emscripten sysroot via --sysroot argument.

Run

Launch a web server to run example before open it to WebGPU compatible web browser (Chrome Canary, Brave Nightly, etc.).

e.g. : launch python3 -m http.server and open web browser to localhost:8000.

Tip

Use Live Server extension in Visual Studio Code to open the HTML file. This extension will update automatically page in real-time when you rebuild the example.

Prerequisites

  • zig, works with Zig 0.15.0+ version
  • emscripten, version 4.0+
  • git (optional)
  • python3 (optional)