wgpu implements the WebGPU-style API in Rust for native and WebAssembly targets. It backs Firefox, Servo, and Deno WebGPU integration and maps to Vulkan, Metal, D3D12, and GLES.
Overview
wgpu is a graphics and compute library that follows the WebGPU standard while remaining idiomatic Rust. Applications use one API whether they run on desktop GPUs or inside wasm in a browser.
Native backends include Vulkan, Metal, DirectX 12, and OpenGL or GLES, with translation layers where needed. On the web, targets include WebGPU and WebGL2. The crate is the foundation for WebGPU in Firefox, Servo, and Deno.
Shaders use WGSL, translated by the Naga component to each backend's shading language when not delegating to the browser's WebGPU implementation. Examples and documentation modules cover architecture patterns and debugging.
Bindings and wrappers exist for many languages through wgpu-native and community projects. Environment variables select backends, adapters, and DirectX shader compilers during development and testing.
Key features
- WebGPU-standard Rust API
- Vulkan, Metal, DX12, OpenGL backends
- WebAssembly WebGPU and WebGL2
- WGSL via Naga translation
- General-purpose GPU compute
- wgpu-native C bindings
- Configurable backend selection
- Firefox and Deno integration
Use cases
- Rust game and engine rendering
- Cross-platform GPU applications
- Browser graphics via wasm
- Graphics research prototypes
- Bindings for other languages