2022-01-27 18:33:47 +00:00
![Dawn's logo: a sun rising behind a stylized mountain inspired by the WebGPU logo. The text "Dawn" is written below it. ](docs/imgs/dawn_logo.png "Dawn's logo" )
2021-09-02 09:51:40 +00:00
2018-08-16 11:50:49 +00:00
# Dawn, a WebGPU implementation
2019-12-05 11:01:41 +00:00
Dawn is an open-source and cross-platform implementation of the work-in-progress [WebGPU ](https://webgpu.dev ) standard.
More precisely it implements [`webgpu.h` ](https://github.com/webgpu-native/webgpu-headers/blob/master/webgpu.h ) that is a one-to-one mapping with the WebGPU IDL.
Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.
2018-08-16 11:50:49 +00:00
Dawn provides several WebGPU building blocks:
- **WebGPU C/C++ headers** that applications and other building blocks use.
2019-12-05 11:01:41 +00:00
- The `webgpu.h` version that Dawn implements.
- A C++ wrapper for the `webgpu.h` .
2018-08-16 11:50:49 +00:00
- **A "native" implementation of WebGPU** using platforms' GPU APIs:
2018-08-20 11:30:46 +00:00
- **D3D12** on Windows 10
2019-12-05 11:01:41 +00:00
- **Metal** on macOS and iOS
- **Vulkan** on Windows, Linux, ChromeOS, Android and Fuchsia
2018-08-20 11:30:46 +00:00
- OpenGL as best effort where available
2018-08-16 11:50:49 +00:00
- **A client-server implementation of WebGPU** for applications that are in a sandbox without access to native drivers
2019-12-05 11:01:41 +00:00
Helpful links:
2018-08-16 11:50:49 +00:00
2019-12-05 11:01:41 +00:00
- [Dawn's bug tracker ](https://bugs.chromium.org/p/dawn/issues/entry ) if you find issues with Dawn.
- [Dawn's mailing list ](https://groups.google.com/forum/#!members/dawn-graphics ) for other discussions related to Dawn.
- [Dawn's source code ](https://dawn.googlesource.com/dawn )
2020-09-11 10:38:46 +00:00
- [Dawn's Matrix chatroom ](https://matrix.to/#/#webgpu-dawn:matrix.org ) for live discussion around contributing or using Dawn.
2020-04-24 12:38:13 +00:00
- [WebGPU's Matrix chatroom ](https://matrix.to/#/#WebGPU:matrix.org )
2018-08-16 11:50:49 +00:00
2019-12-05 11:01:41 +00:00
## Documentation table of content
2018-08-16 11:50:49 +00:00
2019-12-05 11:01:41 +00:00
Developer documentation:
2018-08-16 11:50:49 +00:00
2022-01-27 18:33:47 +00:00
- [Dawn overview ](docs/dawn/overview.md )
- [Building Dawn ](docs/dawn/building.md )
- [Contributing to Dawn ](docs/dawn/contributing.md )
- [Testing Dawn ](docs/dawn/testing.md )
- [Debugging Dawn ](docs/dawn/debugging.md )
- [Dawn's infrastructure ](docs/dawn/infra.md )
- [Dawn errors ](docs/dawn/errors.md )
2018-11-13 09:10:37 +00:00
2020-10-21 14:37:52 +00:00
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
2018-11-13 09:10:37 +00:00
2019-12-05 11:01:41 +00:00
## Status
2017-04-20 18:38:20 +00:00
2019-12-05 11:01:41 +00:00
(TODO)
2018-10-08 13:51:18 +00:00
2018-08-16 11:50:49 +00:00
## License
2017-04-20 18:38:20 +00:00
2019-12-05 11:01:41 +00:00
Apache 2.0 Public License, please see [LICENSE ](/LICENSE ).
2017-04-20 18:38:20 +00:00
2018-08-16 11:50:49 +00:00
## Disclaimer
2017-04-20 18:38:20 +00:00
2018-08-16 11:50:49 +00:00
This is not an officially supported Google product.
2022-04-06 19:37:27 +00:00
2020-03-02 20:47:43 +00:00
# Tint
Tint is a compiler for the WebGPU Shader Language (WGSL).
This is not an officially supported Google product.
## Requirements
* Git
* CMake (3.10.2 or later)
* Ninja (or other build tool)
* Python, for fetching dependencies
2020-04-06 15:19:47 +00:00
* [depot_tools] in your path
2020-03-02 20:47:43 +00:00
## Build options
2020-03-18 14:08:48 +00:00
* `TINT_BUILD_SPV_READER` : enable the SPIR-V input reader (off by default)
* `TINT_BUILD_WGSL_READER` : enable the WGSL input reader (on by default)
* `TINT_BUILD_SPV_WRITER` : enable the SPIR-V output writer (on by default)
* `TINT_BUILD_WGSL_WRITER` : enable the WGSL output writer (on by default)
2020-04-22 00:26:49 +00:00
* `TINT_BUILD_FUZZERS` : enable building fuzzzers (off by default)
2020-03-02 20:47:43 +00:00
## Building
2020-04-06 15:19:47 +00:00
Tint uses Chromium dependency management so you need to install [depot_tools]
and add it to your PATH.
2020-03-02 20:47:43 +00:00
2020-04-06 15:19:47 +00:00
[depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
2020-03-05 15:58:27 +00:00
### Getting source & dependencies
```sh
# Clone the repo as "tint"
2020-10-30 15:03:21 +00:00
git clone https://dawn.googlesource.com/tint tint
cd tint
2020-03-05 15:58:27 +00:00
# Bootstrap the gclient configuration
cp standalone.gclient .gclient
# Fetch external dependencies and toolchains with gclient
gclient sync
2020-03-02 20:47:43 +00:00
```
2020-03-05 15:58:27 +00:00
### Compiling using CMake + Ninja
```sh
2020-03-02 20:47:43 +00:00
mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
2020-03-05 15:58:27 +00:00
ninja # or autoninja
```
### Compiling using CMake + make
```sh
mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build
2020-03-02 20:47:43 +00:00
```
2020-04-28 19:27:38 +00:00
### Compiling using gn + ninja
```sh
mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug
```
2020-04-22 00:26:49 +00:00
### Fuzzers on MacOS
If you are attempting fuzz, using `TINT_BUILD_FUZZERS=ON` , the version of llvm
in the XCode SDK does not have the needed libfuzzer functionality included.
The build error that you will see from using the XCode SDK will look something
like this:
```
ld: file not found:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.fuzzer_osx.a
```
The solution to this problem is to use a full version llvm, like what you would
get via homebrew, `brew install llvm` , and use something like `CC=< path to full
clang> cmake ..` to setup a build using that toolchain.
2020-04-28 19:27:38 +00:00
### Checking [chromium-style] issues in CMake builds
The gn based work flow uses the Chromium toolchain for building in anticipation
of integration of Tint into Chromium based projects. This toolchain has
additional plugins for checking for style issues, which are marked with
[chromium-style] in log messages. This means that this toolchain is more strict
then the default clang toolchain.
In the future we will have a CQ that will build this work flow and flag issues
automatically. Until that is in place, to avoid causing breakages you can run
the [chromium-style] checks using the CMake based work flows. This requires
setting `CC` to the version of clang checked out by `gclient sync` and setting
the `TINT_CHECK_CHROMIUM_STYLE` to `ON` .
```sh
mkdir -p out/style
cd out/style
cmake ../..
CC=../../third_party/llvm-build/Release+Asserts/bin/clang cmake -DTINT_CHECK_CHROMIUM_STYLE=ON ../../ # add -GNinja for ninja builds
```
2020-03-05 15:06:38 +00:00
## Issues
Please file any issues or feature requests at
https://bugs.chromium.org/p/tint/issues/entry
2020-03-02 20:47:43 +00:00
## Contributing
Please see the CONTRIBUTING and CODE_OF_CONDUCT files on how to contribute to
Tint.
2021-04-27 17:55:07 +00:00
2022-02-21 15:19:07 +00:00
Tint has a process for supporting [experimental extensions ](docs/tint/experimental_extensions.md ).