Go bindings for WebGPU, maintained by openfluke.
Native builds use wgpu-native v29 with Go-side bindings (no C compatibility shims). The same module also supports the browser via WASM. Targets include Vulkan, Metal, D3D12, and OpenGL ES.
Module: github.com/openfluke/webgpu
Current release: v1.0.6 (ships wgpu-native v29.0.0.0)
| Tag | What it was |
|---|---|
v1.0.0 |
Initial openfluke release: v29 Go bindings + v29 static libs |
v1.0.2 |
Do not use — Go proxy cached wrong commit |
v1.0.3 |
Do not use — Go proxy cached wrong commit |
v1.0.4 |
Drops legacy ios/amd64; fixes go get module size limit |
v1.0.5 |
Full enums.go regen from webgpu.h + wgpu.h (v29 values); stops enum drift panics |
v1.0.6 |
Windows arm64 libwgpu_native.a rebuilt as gnullvm (links with Go CGO / llvm-mingw; replaces broken MSVC static) |
Monorepo note: wgpu/enums.go must match wgpu/lib/webgpu.h and wgpu/lib/wgpu.h. Regenerate when headers change:
python3 cmd/enums/regen.py(go generate in cmd/enums also works on Linux; on macOS use regen.py because the C parser chokes on _Float16.)
Drift causes native panics (e.g. Depth write enabled for non-depth format) when creating render pipelines.
- Headers:
wgpu/lib/webgpu.h,wgpu/lib/wgpu.h(WebGPU C API + wgpu-native extensions) - Binaries: prebuilt
libwgpu_native.aper target underwgpu/lib/:
| Platform | Path |
|---|---|
| macOS | darwin/amd64, darwin/arm64 |
| Linux | linux/amd64, linux/arm64 |
| Windows | windows/amd64 (gnu), windows/arm64 (gnu / gnullvm) |
| iOS | ios/arm64 (device and Apple Silicon simulator) |
| Android | android/arm64, android/arm, android/amd64, android/386 |
Bindings target the v29 C API directly:
WGPUStringViewfor labels, entry points, shader source, messages- Async ops via
WGPUFuture+wgpuInstanceWaitAny(RequestAdapter,RequestDevice,MapAsync, error scopes, queue work done) wgpuDeviceAddRef,wgpuAdapterGetFeatures,wgpuDeviceGetLimitswithmaxImmediateSize- Shader chains:
WGPUShaderSourceWGSL/SPIRV/WGPUShaderSourceGLSL - Surfaces:
WGPUSurfaceSource*descriptors - Texel copy types:
WGPUTexelCopyTextureInfo, etc. - Push constants → pipeline
immediateDataSize/SetImmediates(native extension) - Validation error scopes implemented in Go (
v29.go)
- macOS arm64 + Metal — loom / lucy: adapter → device → buffer → GPU forward parity (Apple M5)
- Windows arm64 — native wgpu-native v29 static lib; GPU path verified
Other platforms have matching v29 libs in-tree; smoke-test on each target you ship.
go get github.com/openfluke/webgpu@v1.0.6Local development (e.g. from the endgame monorepo):
replace github.com/openfluke/webgpu => ../webgpuNative and JS builds use the same import path; build tags select the backend:
import "github.com/openfluke/webgpu/wgpu"//go:build !js— wgpu-native (this README)//go:build js— browser WebGPU via WASM
| boids | cube | triangle |
|---|---|---|
![]() |
![]() |
![]() |
Vendored artifacts came from official wgpu-native v29 release zips where available. To refresh:
- Download matching
wgpu-*-release.zipfrom wgpu-native releases - Copy
lib/libwgpu_native.ainto the correspondingwgpu/lib/<platform>/<arch>/directory - Ensure shared headers under
wgpu/lib/stay in sync with that release
Windows arm64 exception: upstream only publishes wgpu-windows-aarch64-msvc-*. That MSVC static lib does not link with Go CGO (llvm-mingw / gnu), which is what Welvet and this module use on Windows. Rebuild a gnullvm static lib instead:
# Needs: rustup target aarch64-pc-windows-gnullvm, llvm-mingw, LLVM (libclang)
.\scripts\build_windows_arm64_gnu.ps1CI can also rebuild via .github/workflows/build-wgpu.yml (workflow_dispatch).
API design and WASM support draw on earlier community work (rajveermalviya/go-webgpu, mokiat/wasmgpu). This repository is maintained independently by openfluke; vendored binaries and the v29 native bindings are openfluke-specific.
See LICENSE.


