Import Tint changes from Dawn

  - 97ab6a3a706121a6a3c046c13361e9964d53feaa [ir][spirv-writer] Emit store instructions by James Price <>
  - 75aaa49d772bf99f9f6c3cc662422fe74626ff93 [ir][spirv-writer] Emit function variables by James Price <>
  - 6e40b1a9df6215573aab4dfe0a814aebb53a554e [tint][ir][ToProgram] Begin emitting Switch statements by Ben Clayton <>
  - 43b110ce5311aaeaef9b648fe53adfa5a850e7d4 [ir] Only show type on lhs by dan sinclair <>
  - c42014805a3d4829109930f47c8d8621e39d4760 [tint][ir] Guard transform source sets in GN build by James Price <>
  - 54d1d714ce7cac3762bb997393698d0cd059c8f1 [ir][spirv-writer] Move code to `ir` subdirectory by James Price <>
  - 90b8cc1e93677bc76db880fc284fcb5da27714d6 [ir] Add load instruction by James Price <>
  - 0bb1bb3067dafb048fea59579e5885a7299e5dc4 [ir] Remove references, indirection and address-of by James Price <>
  - 82db91ac96fcebcb72f2edc4a49672d995c5a430 [ir][spirv-writer] Emit `If` flow nodes by James Price <>
  - 7ac28d3c6e5159c70525ebe4609459a141630f72 [ir] Add AddEmptyEntryPoint transform by James Price <>
  - 95b06129f0f9b0141fa681ae7d0a29da3a814d5c [ir] Add base `ir::transform::Transform` class by James Price <>
  - db5ad9f357b5be9e6a89e57b10a82dc9e0e60d2b [tint] Materialize compound assignment RHS by James Price <>
  - 11ee6b6cc6775ff54bbef5bac2d20c2e75b83fe1 [ir] Handle phony assignment. by dan sinclair <>
  - bbaa456b18e052ddcc6da7b061cbbad046673196 [ir] Remove instruction allocator. by dan sinclair <>
  - 0531610e99a2f193e3f425704d665d5512a90881 [ir] Add basic block arguments. by dan sinclair <>
  - 9fc46dc3c1e2e7f9fbbc23f3d76f8a5da9c38aef [ir] Drop address space and access from ir::Var. by dan sinclair <>
  - 25ae3114b37811aa185b3d1cc097e2808a0f6fb1 [tint][ir][ToProgram] Emit returns with values by Ben Clayton <>
  - a6e7cfc1d08c5bf41caa9116b84fe92c65de2ed1 [tint][ir][ToProgram] Emit returns without values by Ben Clayton <>
  - 6ab77f16f0560b84b7e67e3e110c3e218dcd38b7 [tint][ir][ToProgram] Emit 'else if' instead of 'else { if' by Ben Clayton <>
  - 1ea1e1a37578539aeafe13177346dadd3f171af8 [tint][ir][ToProgram] Begin flow node traversal by Ben Clayton <>
  - 0b9cb101bf878ed3e672123f93cffae573a2f329 [tint][ir][ToProgram] Implement var expressions by Ben Clayton <>
GitOrigin-RevId: 97ab6a3a706121a6a3c046c13361e9964d53feaa
Change-Id: I09d69b9ce06712f1e95b64d53f882ec8e032be26
Commit-Queue: Ben Clayton <>
Kokoro: Kokoro <>
Reviewed-by: Ben Clayton <>
51 files changed
tree: 8c082eca5ecafc81cde395ba48c40f3cfcd7b09c
  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
  21. Doxyfile
  23. OWNERS
  26. standalone.gclient
  27. tint_overrides_with_defaults.gni


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.