dawn-sys provides unsafe Rust bindings for Dawn, the open-source and cross-platform implementation of the WebGPU standard that powers Google Chrome, Microsoft Edge, and other Chromium-based browsers. It also provides Pre-built Dawn binaries (webgpu_dawn.dll), kindly provided by Mārtiņš Možeiko's build-dawn automation on GitHub Actions that rebuilds the Dawn binaries once per week. This crate contains a build script that handles chores like copying necessary binaries to the output directory, making everything ready out of the box.
Note that this crate is not providing rustdoc for its exported items. Check https://webgpu-native.github.io/webgpu-headers/index.html for documentation.
If you are looking for safe and idiomatic Rust wrappers for Dawn or webgpu.h, you should consider dawn-rs instead of this crate, which provides higher-level and more "Rust-style" abstractions based on this crate. If you are just looking for a higher-level graphics API wrapper and guarenteed consistent behavior and performance with mainstream browsers (Google Chrome, Microsoft Edge, ...) isn't one your major concerns, please also try wgpu before reaching for dawn-rs or dawn-sys. wgpu is another open source and cross-platform implementation of the WebGPU specification that is fully written in Rust and is used in Mozilla Firefox, Servo and Deno for WebGPU support. It also serves as the de-facto standard of high-level, cross-platform graphics development in the Rust ecosystem.
This crate is still a work in progress. USE AT YOUR OWN RISK. It should serve in most common cases but may lack certain APIs or fail on corner cases. The aforementioned wgpu crate is way more mature and should always be considered ahead of this crate.
This crate is currently Windows-only. Given the cross-platform capabilities of Dawn, it is planned to eventually support macOS, Linux and web in the long term, but it is not currently a key focus of the maintainer of this crate. If you'd like to help, you are welcome to open an issue for further discussion.
The webgpu_dawn.dll distributed by this crate currenly contains only the Direct3D 12 Backend. Requesting an adapter of other backends will result in an error. This is a limitation of build-dawn and we plan to set up a custom GitHub Action to provide more options on prebuilt binaries in the near future.
This crate is licensed under the BSD-3-Clause license, aligning to Dawn and WebGPU-Headers. This whole repository, including the code generator, is licensed under the GNU General Public License, Version 3.0, see README.md at the repository root.
This crate welcomes all kind of contributions. Open an issue or PR at any time for bugfixes or feature requests.