gfx-rs/wgpu
wgpu
wgpu is a cross-platform, safe, pure-Rust graphics API. It implements the WebGPU standard on top of native graphics APIs (Vulkan, Metal, Direct3D 12, OpenGL ES) and the browser's WebGPU/WebGL2 implementations. The same Rust code can target a Linux Vulkan driver, a macOS Metal driver, a Windows DX12 driver, or compile to WebAssembly and run in a browser.
The repository is the upstream home of the WebGPU implementation that powers WebGPU in Firefox, Servo, and Deno. It also produces the standalone wgpu Rust crate used by many native applications and game engines.
What lives here
This is a Cargo workspace of around two dozen crates. The most important ones are:
| Crate | Purpose |
|---|---|
wgpu |
The native Rust API (wgpu/). The crate that downstream applications depend on. |
wgpu-core |
A pure-Rust, FFI-friendly implementation of WebGPU: resource tracking, validation, command encoding (wgpu-core/). Used by Firefox and Deno without the wgpu crate. |
wgpu-hal |
The hardware abstraction layer with a backend per platform graphics API (wgpu-hal/). |
naga |
The shader translator (WGSL/SPIR-V/GLSL → Naga IR → SPIR-V/MSL/HLSL/GLSL/WGSL). |
wgpu-types |
Plain-data types shared between wgpu, wgpu-core, and wgpu-hal. |
naga-cli |
Command-line frontend for naga. |
cts_runner |
Runs the WebGPU Conformance Test Suite against wgpu via Deno. |
deno_webgpu |
Deno's WebGPU bindings (02_surface.js, 01_webgpu.js, Rust bridge). |
player |
Replay tool for traces produced by wgpu-core's tracing feature. |
wgpu-info |
CLI that dumps adapter/device capabilities. |
xtask |
Repo automation: tests, CTS, changelog audits, web build. |
Where to start
- New to
wgpuas a user → Getting started, then crates/wgpu for the public API. - New to graphics programming → start with Learn Wgpu outside this repo, then come back here.
- Contributor → How to contribute and Architecture.
- Hacking on shader translation → crates/naga.
- Hacking on a specific backend → crates/wgpu-hal.
- Want the big picture → Architecture. For the canonical diagram, see
docs/big-picture.png.
Supported platforms
| API | Windows | Linux/Android | macOS/iOS | Web (wasm) |
|---|---|---|---|---|
| Vulkan | yes | yes | via MoltenVK | — |
| Metal | — | — | yes | — |
| DX12 | yes | — | — | — |
| OpenGL | best-effort (GL 3.3+) | best-effort (GL ES 3.0+) | requires ANGLE | best-effort (WebGL2) |
| WebGPU | — | — | — | yes |
See crates/wgpu-hal and its per-backend pages for what each backend supports.
License
Dual-licensed under MIT or Apache-2.0. See LICENSE.MIT and LICENSE.APACHE.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.