1
2
Fork
You've already forked wgpu-zig
0
Idiomatic Zig bindings for https://github.com/gfx-rs/wgpu-native
  • Zig 99.8%
  • C 0.2%
2026年07月12日 19:35:34 +02:00
examples/sort v27.0.4.0 -> v29.0.1.1 2026年07月12日 19:25:03 +02:00
src v27.0.4.0 -> v29.0.1.1 2026年07月12日 19:25:03 +02:00
.gitignore move from building locally to fetching compiled distributions 2026年03月05日 15:44:18 +01:00
build.zig drop emsdk dependency for emscripten target 2026年05月10日 21:43:39 +02:00
build.zig.zon v27.0.4.0 -> v29.0.1.1 2026年07月12日 19:25:03 +02:00
README.md Add README 2026年07月12日 19:35:34 +02:00

wgpu

Idiomatic Zig bindings for wgpu-native, exposing WebGPU for native applications and the web.

The package translates the upstream C API at build time, wraps resource lifetime and descriptors in Zig types, and links wgpu-native on desktop or Dawn's Emscripten WebGPU package for the web.

Install

zig fetch --save git+https://codeberg.org/shahwali/wgpu-zig.git

Targets: macOS, Windows, Linux, and Emscripten (WebGPU). Requires Zig 0.16.0 or newer.

constwgpu=@import("wgpu");constinstance=trywgpu.Instance.init(null);deferinstance.deinit();constadapter=tryinstance.requestAdapterSync(.{});deferadapter.deinit();constdevice=tryadapter.requestDeviceSync(.{});deferdevice.deinit();constqueue=trydevice.getQueue();deferqueue.deinit();

Examples

See examples/sort for a complete GPU compute example.

It is also used in knots as an alternative to the Vulkan backend.