// the find
gfx-rs/wgpu
A cross-platform, safe, pure-Rust graphics API.
wgpu is a safe Rust graphics API built on the WebGPU standard, running natively on Vulkan, Metal, and D3D12, and in-browser via WebAssembly. It's not a toy — it's the actual WebGPU backend shipped in Firefox and Deno, which means it gets hammered against the official CTS. If you want cross-platform GPU code that runs the same path from desktop to browser, this is the most serious option in the Rust ecosystem.
1. Production-validated: being Firefox's WebGPU backend means it runs against the full W3C Conformance Test Suite regularly, not just the maintainers' example apps. Bugs get found and fixed at browser scale. 2. Naga is a serious shader compiler — translates WGSL to SPIR-V, MSL, HLSL, and GLSL, all in-house. You don't need a separate shader toolchain per backend, and it ships fuzz targets. 3. The WebGPU API design prevents whole classes of GPU programming mistakes — no dangling descriptor sets, no unsynchronized writes, no 'works on my machine' VRAM corruption. The safety model is principled, not just a thin validation wrapper. 4. Single Rust codebase genuinely runs native and in-browser via wasm, with explicit fallback logic (WebGPU → WebGL2). The platform support matrix is honest about what's first-class vs. best-effort.
1. The WebGPU spec is still a Working Draft and wgpu tracks it imperfectly — there is explicitly no concise list of which WGSL features work where, so writing shaders that behave identically on native Naga vs. browser WebGPU vs. WebGL2 fallback requires trial and error. 2. The OpenGL backend is labeled 'best effort' and macOS requires routing through ANGLE. If your target audience runs Linux ARM or older embedded GPUs, you will hit missing features and silent fallbacks. 3. Ray tracing is extension-only and backend-gated — the examples exist but they're not portable, and someone coming from DX12 expecting full RT parity will find gaps. 4. The WebGPU abstraction deliberately withholds low-level control: no explicit memory heaps, no pipeline barriers, no subpasses. For general game dev this is fine; for squeezing out GPU utilization on a known target platform, you'll eventually hit a ceiling the API won't let you cross.