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. More precisely, it provides:
- Unsafe bindings to
webgpu.h, which is a one-to-one mapping of the WebGPU IDL. This crate mainly exposes bindings generated usingrust-bindgenbut also revamps some details for a more handy API. - Pre-built Dawn binaries (
webgpu_dawn.dll), kindly provided by Mārtiņš Možeiko'sbuild-dawnautomation 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.
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.
This crate assumes your familiarity with GPU development using webgpu.h, the WebGPU C API. Because of this (and also considering that currently a large part of webgpu.h APIs have still not been documented yet :(), this crate is not providing rustdoc for a large part of its exported items except for those that have been well documented in webgpu.h and those that are re-exported in dawn-rs. Completing the missing docs in webgpu.h is not currently a key focus of the maintainer of this crate. If you'd like to help, please contribute to WebGPU-Headers and this crate will follow upstream updates.
This crate is licensed under the BSD-3-Clause license, aligning to Dawn and WebGPU-Headers. This whole repository is also 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.