704: Pipeline layout validation r=cwfitzgerald a=kvark **Connections** Implements a solid part of #269 Starts converting the function to return results, related to #638 cc @GabrielMajeri **Description** This change matches shader bindings against the pipeline layout. It's *mostly* complete, minus some bugs and not handling the `storage_texture_format` properly. The risk here is that Naga reflection may have bugs, or our validation may have bugs, and we don't want to break the user content while this is in flux. So the PR introduces an internal `WGPU_SHADER_VALIDATION` environment variable. Switching it to "0" skips Naga shader parsing completely and allows the users to unsafely use the API. Another aspect of the PR is that some of the functions now return `Result`. The way I see us proceeding is that any errors that we don't expect users to handle should result in panics when `wgpu` is used natively (i.e. not from a browser). These panics would happen in the "direct" backend of wgpu-rs (as well as in wgpu-native), but the `Result` would not be exposed to wgpu-rs, so that it matches the Web behavior. At the same time, browser implementations (Gecko and Servo) will check the result on their GPU process and implement the WebGPU error model accordingly. This means `wgpu-core` can be super Rusty and safe. **Testing** Running on wgpu-rs examples. Most of them fail to get parsed by Naga, but `boids` succeeds and passes validation 🎉 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This is an active GitHub mirror of the WebGPU implementation in Rust, which now lives in "gfx/wgpu" of Mozilla-central. Issues and pull requests are accepted, but some bidirectional synchronization may be involved.
WebGPU
This is the core logic of an experimental WebGPU implementation. It's written in Rust and is based on gfx-hal with help of gfx-extras. See the upstream WebGPU specification (work in progress).
The implementation consists of the following parts:
- internal Rust API for WebGPU implementations to use
- Rust types shared between
wgpu-core,wgpu-native, andwgpu-rsplayer- standalone application for replaying the API traces, useswinit
This repository contains the core of wgpu, and is not usable directly by applications.
If you are looking for the user-facing Rust API, you need wgpu-rs.
If you are looking for the native implementation or bindings to the API in other languages, you need wgpu-native.
Supported Platforms
| API | Windows 7/10 | Linux & Android | macOS & iOS |
|---|---|---|---|
| DX11 | ✅ | ||
| DX12 | ✔️ | ||
| Vulkan | ✔️ | ✔️ | |
| Metal | ✔️ | ||
| OpenGL | 🚧 | 🚧 | 🚧 |
✔️ = Primary support — ✅ = Secondary support — 🚧 = Unsupported, but support in progress