wgpu
A cross-platform, safe, pure-Rust graphics API.
wgpu is a Rust graphics library that lets you write GPU rendering code once and run it on Windows, Linux, macOS, iOS, Android, and the web, without rewriting for each platform's native graphics API.
wgpu is a safe, cross-platform graphics library written in pure Rust. Graphics programming usually means writing code against a specific GPU API like Vulkan, Metal, D3D12, or OpenGL, which means rewriting parts of your code for each platform. wgpu hides all of that behind one unified API so you can write your rendering code once and have it run on Windows, Linux, macOS, iOS, Android, and the web.
The API design is based on the WebGPU standard, the modern web graphics specification that aims to replace WebGL. On native platforms, wgpu translates your calls down to Vulkan, Metal, D3D12, or OpenGL as appropriate. On the web through WebAssembly, it runs on top of WebGPU directly, or falls back to WebGL2 where WebGPU is not yet available. Shaders are written in WGSL, the shading language that ships with the WebGPU standard.
wgpu is also the actual implementation powering WebGPU inside Firefox, Servo, and Deno, so the same code that runs in your Rust app also runs inside major browsers and runtimes. The project publishes C bindings as a separate crate called wgpu-native, which lets you use wgpu from C, C++, and dozens of other languages.
You would reach for wgpu when you are building anything that needs to draw with the GPU and want a single codebase that works across major platforms: games, simulations, scientific visualization tools, creative coding apps, or custom rendering engines. The minimum supported Rust version for using the crate is 1.87. The full README is longer than what was provided.
Where it fits
- Build a cross-platform 3D game in Rust that runs on desktop and in the browser from a single codebase.
- Write scientific visualization or GPU compute software that deploys to Linux, macOS, Windows, and Android without platform-specific code.
- Create a custom rendering engine or creative-coding tool that runs natively and in the browser via WebAssembly.
- Use wgpu-native C bindings to drive the GPU from C, C++, or another language that is not Rust.