Import Tint changes from Dawn

  - 07c73adc95a1177315563225ad57517af4376633 [tint] Remove unused includes from MSL validate.h by James Price <>
  - 700892daf642d290bee5885644389af86d1d3ff0 Add WGSL writer helper to create a WGSL program. by dan sinclair <>
  - b94b9ca68ecc762078f1540e98e917f395ba1747 [tint][fuzz][ir] Include IR disassembly when SPIR-V val f... by Ben Clayton <>
  - fc36dcfaa23772a4771dfdeb4df8d7b5d378a6a8 [tint][ir] Fix UAF in validator by Ben Clayton <>
  - 0a60d528a4a693ba225af966043f01ae1fdfb997 [tint][ir] Stylize more validator diagnostics by Ben Clayton <>
  - a655053bb2a77aeb4a7ebecd5f697c2102c12d6a [tint] Use EXPECT_DEATH_IF_SUPPORTED() by Ben Clayton <>
  - 590110ebb1dae02b4fc98ed5ca08f9c3aeabb3f5 [tint][ir] Fix Std140 transform for arrays of matrices by Ben Clayton <>
  - f35bd1bae613c97b4d93c19dd23a7009cd10e5fb [spirv-reader] Add transform to handle shader IO by James Price <>
  - a5ded402136cc3e734bcf5692c3534f7aa2e5afd [ir] Add ReferencedModuleVars helper by James Price <>
  - 0bb6d4d0b5c854e83cf3846092eb3079afd72194 [tint][ast] Include WGSL dump in fuzzer ICE message by Ben Clayton <>
  - c25a748790c61d35b185fb2996875efaeb530662 [ir] Add Instruction::DetachResult() helper by James Price <>
GitOrigin-RevId: 07c73adc95a1177315563225ad57517af4376633
Change-Id: Ifa9a927222958aed0240d2b9a99024a3c8572750
Kokoro: James Price <>
Commit-Queue: James Price <>
Reviewed-by: James Price <>
158 files changed
tree: 55020685aa0c6e2265a5c7714e0be152316a7bd2
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. scripts/
  8. src/
  9. third_party/
  10. tools/
  11. .clang-format
  12. .gitignore
  13. .gn
  16. CMakeLists.txt
  17. CMakeSettings.json
  19. CPPLINT.cfg
  20. DEPS
  22. OWNERS
  25. standalone.gclient


Note: This repo is read-only, minimized mirror of the Dawn repo.

Tint changes should be made in the Dawn repo.

Tint is a compiler for the WebGPU Shader Language (WGSL).

This is not an officially supported Google product.


  • Git
  • CMake (3.10.2 or later)
  • Ninja (or other build tool)
  • Python, for fetching dependencies
  • depot_tools in your path

Build options

  • 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)
  • TINT_BUILD_FUZZERS : enable building fuzzzers (off by default)


Tint uses Chromium dependency management so you need to install depot_tools and add it to your PATH.

Getting source & dependencies

# Clone the repo as "tint"
git clone tint
cd tint

# Bootstrap the gclient configuration
cp standalone.gclient .gclient

# Fetch external dependencies and toolchains with gclient
gclient sync

Compiling using CMake + Ninja

mkdir -p out/Debug
cd out/Debug
cmake -GNinja ../..
ninja # or autoninja

Compiling using CMake + make

mkdir -p out/Debug
cd out/Debug
cmake ../..
make # -j N for N-way parallel build

Compiling using gn + ninja

mkdir -p out/Debug
gn gen out/Debug
autoninja -C out/Debug

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/

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.

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.

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


Please file any issues or feature requests at


Please see the contributing guide in the Dawn repo.