Import Tint changes from Dawn

  - 55c0c9d950edb4f45b2f94d5c3e4114fc30609e8 tint: Add abstract numerics to vector and matrix construc... by Ben Clayton <>
  - d3de38d7e3880a90cbed8f8fb895729e580c8fbd tint: Simplify the resolver constant evaluation by Ben Clayton <>
  - 8f4f4495408cfde7755be8127180178015bf7d40 tint/writer: Do not attempt to use invalid programs by Ben Clayton <>
  - 6522837acbf96682583ada4ead5c8e86f28df437 tint: Add `enable_abstract_numerics` flag on Resolver by Ben Clayton <>
  - 43581f1fb62ced507e1693c2e8959ed342dd7f6a tint: Add new methods to semantic Switch nodes by Ben Clayton <>
  - a2ce4ecc8b325ff79176a867b6074b6ca733851b tint: Add more helpers to resolver_test_helper.h by Ben Clayton <>
  - d99af036634c3dc612d18042465bfcc45203fffc tint: Add utils::UniqueVector::data() by Ben Clayton <>
  - ab4c0357629178ec2c217b4b05ad715142546fe1 tint: fix HLSL countOneBits and reverseBits for i32 args by Antonio Maiorano <>
  - e9ce8326b7843be34e8a31a5a54600cb924c83f2 tint: Minor, miscellaneous cleanups by Ben Clayton <>
  - eee9f88ba21b182d7eb23bbc85af17f69185e34a tint: Extract intrinsic-table common type to helper by Ben Clayton <>
  - 1b35e3f9a8c10c11d750fde76f0862e8e9bc9534 tint: Add new sem::Type helpers by Ben Clayton <>
  - e5a67ac891a5c8aa584b7998d35453a29b778a93 tint: Remove ast::CallExpression -> sem::Call implicit ma... by Ben Clayton <>
  - 7b921fb4c778b324d706f78a91d5e047626f2292 tint: No-op Resolver refactoring by Ben Clayton <>
  - 86a617f1108cbfa49c8c1faebc7b4af8acd36588 Add InsertBraces: true to .clang-format by Austin Eng <>
  - 2081ee43bf51005e2dbed2b271254d517e998fd0 tint: Add sem::Materialize by Ben Clayton <>
  - 6ac00ed0c0cff0401da91b4faad649d0ea81f2d5 tint: IntrinsicTable: Add abstract numeric types by Ben Clayton <>
  - b1fa457ab3c362a12bd885254352fc617d89f808 tint: IntrinsicTable: Use [[display]] name for type match... by Ben Clayton <>
  - b0664684cd887f8c8163e70b64c797852b86e276 tint: Support tuples in utils::Hash(). by Ben Clayton <>
  - 7f2b8cd8fc8edf464602ea64d2145def40fa3475 tint: Refactor Extensions / Enables. by Ben Clayton <>
  - 23696b1ba3fd523f9f989677890af18db0d68d7a tint: Implement abstract-numeric overload resolution by Ben Clayton <>
  - 2e681052b313ed547189d95d58d73081c028d604 tint: Fix use-after-free by Antonio Maiorano <>
  - c670018aea9f3ff989699b47c0b5d5a977213cc8 tint: intrinsics.def Support [[precedence]] decoration by Ben Clayton <>
  - 5ff7d67bf341af630c8945296155b77edc13ef81 tint: Validate that sampled texture type must be f32, i32... by Antonio Maiorano <>
  - e0ff664a7f0dee5ac9c3c19e48121b6cfca89c31 tint: Add sem::Type::ConversionRank() by Ben Clayton <>
  - 4c9ed74b5e5bded47aa034026a6ea80b27dd666b tint: IntrinsicTable: Rename open/closed -> template by Ben Clayton <>
  - aaa9ba30436bdb23a59b9eaa4e65f1808cba0dec tint: Simplify sem::Constant::Scalar by Ben Clayton <>
  - 661e33ca185f766019bd27fedda57a354efed787 tint: Cleanup of IntrinsicTable by Ben Clayton <>
  - 8ba6e1d6ecdd3f9438b5034d32b301152cb931f8 tint: limit expression depth to avoid stack overflow in b... by Antonio Maiorano <>
  - 5880ed164abb36f816bbea1a715ad7bc988c3648 tint: Fix edge for CallSiteRequiredToBeUniform by James Price <>
  - 3b5edf143505f6b97f065e83de0d63f647fd3e50 tint: Add matrix identify and single-scalar ctors by Ben Clayton <>
  - 6ae608cb03840d1f8b075289f4445f149ab33f0a tint: Add constructors and conversions to the intrinsic t... by Ben Clayton <>
  - 9ff8abf34711e4e740b68c10fc0c90bbc441c7e5 tint: Fix clang chromium-style warnings treated as errors by Ben Clayton <>
  - e6b6777c8e56b0940315b9fef97a13e021c61747 tint: Fix MSL generation of '&' and '|' with booleans by Ben Clayton <>
  - 35f0fcaac0f6e0d0a56e8f5f7c00cd297256d518 tint/uniformity: Use non-recursive graph traversal by James Price <>
  - a89ff5981bc0c17e980a5dbdb4f2da870ed79db0 tint: Show where control flow became non-uniform by James Price <>
  - 1c75921db9c0095d7ab96c686f51efa2951b2f4f tint: fix translation of DP4a on HLSL by Jiawei Shao <>
  - d8e77e2e73afd5bb2238ac322d7acbdd084ec410 tint: Prevent integer overflow in IntrinsicTable by Ben Clayton <>
  - 83fc247d4bb9ab23616a697f272d69f29f44447f tint: correctly define user-defined literals by Antonio Maiorano <>
  - 59e23943f3b1442281208e879e6bc4c5f478ca91 tint: Minor IntrinsicTable cleanup by Ben Clayton <>
  - 77473b469958b242509c9eb9271bbcf908e791de tint: Split tables for unary and binary operators by Ben Clayton <>
  - 62bfd318aefae4b5a1f50813f90bf0b8b821849b tint: Implement `f16` keyword in Tint frontend by Zhaoming Jiang <>
  - c4b380b8af94fe8b7a61ae8bd3f735f9d7a51380 tint: Generalize sem::Vector to allow 16bits subtype by Zhaoming Jiang <>
  - ed6ff9c948005a23fb2d592c5ea069d778bca083 tint: Rename kNotAnExtenxion to kNoExtension by Zhaoming Jiang <>
  - ab9757036bd6b2fe86c4e937db0524463ba0c0f8 tint: Implement DP4a on HLSL writer by Jiawei Shao <>
  - 53547db1d4f045d93ee408b6a30da25eb88ef056 tint: Add missing source information for | and || by James Price <>
  - 816148fe3291d3def83de76584cfe32af8572f49 tint: Add implicit CF_return->{last cf} edge by James Price <>
  - cd55f15c98de761c6410e19670398c149aa96dbe tint/resolver: Fix chromium-style warning treated as error by Ben Clayton <>
  - 7dd0ab791a59c89b628981f82f56b9ee3e8208b6 tint: Show the source of non-uniformity by James Price <>
  - 9c03abfb554fd64adb66a9f11d7e84766cdc15b3 tint: Show the reason for a uniformity requirement by James Price <>
  - 874b61f1badfe275c480d1dcb6d32b867391de73 tint/uniformity: Retain control flow graphs by James Price <>
  - be656f7984a48e3c4e9a3c9dcc0ba7bbdc3da278 tint: Implement uniformity analaysis by James Price <>
  - 8e68f0aad7c3994ddbd1914a48d82c43dd6e7e56 tint: Resolve empty loop continuing blocks by James Price <>
  - 2cf32b13d7c294a7a3b4e87f9ab11aebbb519e81 tint: Make ScopeStack key type generic by James Price <>
  - 791b4351d1860e1d447f182619e8bd1023dc47eb tint: Add transform to disable uniformity analysis by James Price <>
GitOrigin-RevId: 55c0c9d950edb4f45b2f94d5c3e4114fc30609e8
Change-Id: I584598c20d24d8cadb29f63b5e1f46aac06aebb2
Kokoro: Kokoro <>
Commit-Queue: Ben Clayton <>
Reviewed-by: Ben Clayton <>
147 files changed
tree: d4cc7f3ffd8e09f8f58423b4d6f07b543eeb096a
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. src/
  8. test/
  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.