Import Tint changes from Dawn & update DEPS

Also includes an update to the Windows Kokoro scripts to fetch depot_tools a more conventional way.

Changes: - 95dc1ad0601538ecb5744d944bca90d325183056 Remove duplicated AST and SEM headers in BUILD.gn by dan sinclair <dsinclair@chromium.org>
  - 60804716626ee54501a38c4730eae16f97455ac4 Split demangler to separate lib. by dan sinclair <dsinclair@chromium.org>
  - 6e8a23097ac58a13ae0e812cd51253936595490f Cleanup some includes. by dan sinclair <dsinclair@chromium.org>
  - 727503d20565dfb21f87ed17925ab74567d4fbb8 tint/resolver: Pass std::function by ref by Ben Clayton <bclayton@google.com>
  - ee665a4240d657b53510fbc6398a0b03044e164e tint: add precise float mod polyfill and enable it for HLSL by Antonio Maiorano <amaiorano@google.com>
  - 971318f7a2e7270b81b786da1fa8420a1bc3e02a tint: Replace all remaining AST types with ast::Type by Ben Clayton <bclayton@google.com>
  - 03b09f10996430ac3f0a978b4b95c5a46c1c8139 tint/sem: Add FunctionExpression by Ben Clayton <bclayton@google.com>
  - a5b9e96b39ce81e45d2861681b7354bb3c239b8e tint/reader/spirv: Work around pointers to null store typ... by Ben Clayton <bclayton@google.com>
  - 1131d31761671e9e87baf57da0ec1fe5c925a61d tint/ast: Remove ast::StorageTexture by Ben Clayton <bclayton@google.com>
  - c66b5e6922036cd77e4c0db2e7c37111108736bb tint/resolver: Fix null dereference by Ben Clayton <bclayton@google.com>
  - ec20758675a2281bc4788f03a8171b7252ae940c tint: polyfill remainder to handle negative operands by Antonio Maiorano <amaiorano@google.com>
  - a5fec206c9f8e7b3b809670a216e07310969b0ef tint/ast: Remove ast::DepthTexture and ast::DepthMultisam... by Ben Clayton <bclayton@google.com>
  - 4906b039639180bb8f878050f759ddd8c2a6e24d tint/ast: Remove ast::ExternalTexture by Ben Clayton <bclayton@google.com>
  - ed3389faeeb1c9d7f204094a3d6730b3a1ca0109 tint/ast: Remove ast::Sampler by Ben Clayton <bclayton@google.com>
  - 6e0a51521f52f927e8f76ce38e358c7373653a78 tint/ast: Remove scalar types from ast::* by Ben Clayton <bclayton@google.com>
  - eb30a0ddee907a8305554c6079ef1ef2b83f7bfc tint/resolver: Fix validation of type constructor without... by Ben Clayton <bclayton@google.com>
  - 031e2f5585baa1e865806e1b01fc40977658e211 tint/resolver: Resolve builtin enumerators by Ben Clayton <bclayton@google.com>
  - 0ddddb00cbe0383d17e72d37175deb253051b532 tint/resolver: Start handling sem::Expression by Ben Clayton <bclayton@google.com>
  - 4e4cada291bb4b0469117f83f3b6bf67efbfb3ab tint/transform: Simplify Renamer transform by Ben Clayton <bclayton@google.com>
  - f973d514a113f987907222e1a408b11f8001c128 tint: Add ast::CheckIdentifier() test helper by Ben Clayton <bclayton@google.com>
  - b75252b7aa561d9d5599df0cb50a98d90fd5a7c1 tint/ast: Change TypeDecl::name to an ast::Identifier. by Ben Clayton <bclayton@google.com>
  - 651d9e2558bcb9870b9a8f1dc87653bb2d5a0d36 tint/ast: Change Variable::symbol to Variable::name by Ben Clayton <bclayton@google.com>
  - 199440e37cbf7024ce56a5950d83669a62959870 tint/ast: Change StructMember::symbol to StructMember::name by Ben Clayton <bclayton@google.com>
  - ce31d187ef1fca96d17fcfd7403696f5c6e3f2ff tint/ast: Change Function::symbol to Function::name by Ben Clayton <bclayton@google.com>
  - 057a7337584e4776fc7b6a7e61a1ee1447784fae tint: Allow IdentifierExpressions to be templated by Ben Clayton <bclayton@google.com>
  - cf0e9301b24d47800a5522035ca57fec19f37eac tint: Improve the output of DependencyGraph by Ben Clayton <bclayton@google.com>
  - 9e36723497d82e60d561f08f35cf0e83bcbecb83 tint: Rework TypesBuilder::array() to take attribute list by Ben Clayton <bclayton@google.com>
  - 5b50790d707908a3deb2afec01651a4fc80b28b5 tint/reader: Use ProgramBuilder helpers by Ben Clayton <bclayton@google.com>
  - 35089ee43717181df5a1227503e4cf187ff481b4 tint: Use ProgramBuilder::Bitcast() by Ben Clayton <bclayton@google.com>
  - d775a26d82b15f421bcfd4a5e7bc6673dc7f5110 tint: Use ProgramBuilder::CallStmt() by Ben Clayton <bclayton@google.com>
  - 1ebada0dad96d9239ef4438b45f5d38f73dbfc32 tint: Use ProgramBuilder::Return() by Ben Clayton <bclayton@google.com>
  - 6adb65c488a12c49627f8f7bfb62ee49045fe033 tint: Use ProgramBuilder::Discard() by Ben Clayton <bclayton@google.com>
  - 17aa653fa92c1f9b29223b8035275290ce318d14 tint: Remove body_attributes param from ProgramBuilder::F... by Ben Clayton <bclayton@google.com>
  - 1906857a50d61c661315d60d10ec67e42cff48fe tint: Remove ast::Void by Ben Clayton <bclayton@google.com>
  - d9c0f2178dd5459ccb8063f5c6fa35775d8c87eb tint/resolver: Make pointer aliasing a hard error by James Price <jrprice@google.com>
  - 01ac21cc9aba7471833e9b6d8502c2a6600dd2e6 tint: Rename ProgramBuilder::Construct() to Call() by Ben Clayton <bclayton@google.com>
  - ad733018565d2611083b783a45dee21e08611dfb tint/type: Rename ShortName to type::Builtin by Ben Clayton <bclayton@google.com>
  - fc2083a6169d65428dbddd4ec7c73886d32635b4 tint: Make CreateScalar and ZeroValue members by James Price <jrprice@google.com>
  - 40ffda4b5eb7408972ab26329a6e1808867d914a tint/const-eval: Add flag to use runtime semantics by James Price <jrprice@google.com>
  - c1799cc75ac1b511a088b86939d6f14f7903f3b2 Add a `tint_info` command. by dan sinclair <dsinclair@chromium.org>
  - 0b4a2f1f50b8a4adad81671e94e52a915d20c9f9 tint: Add sem::Expression by Ben Clayton <bclayton@google.com>
  - ef1811a18baba11564fe17d7d1fc925534a6f44b tint: static_assert that Sem.Get() template arg is needed by Ben Clayton <bclayton@google.com>
  - ad3156551ca2593892ad6148742cf2d737358317 tint/ast: Add AccessorExpression by Ben Clayton <bclayton@google.com>
  - 3fb9a3fba18984fc9032268f57fc70dc8bb57d1f tint/sem: Rename Expression to ValueExpression by Ben Clayton <bclayton@google.com>
  - 98dc5a86cc52c54a3106e2675dc38f12dfe66244 tint/ast: Make DiagnosticControl a plain struct by James Price <jrprice@google.com>
  - 85e13bcd6800072a128a68639a1d53bb485181c9 spirv-reader: fix emission of INT_MIN literal by David Neto <dneto@google.com>
  - 2117f80f8b1680e465e58fa5ca7cfcd78be74f0f tint: Reduce repetition for ty.type_name() by Ben Clayton <bclayton@google.com>
  - 2cdf134b2b74119f1527755f20522c12cd8dea22 tint: Add ast::TemplatedIdentifier by Ben Clayton <bclayton@google.com>
  - 89a717bacf3577a3156787b19508f6b592b6843f tint: Have ast::TypeName use ast::Identifier by Ben Clayton <bclayton@google.com>
  - 12914eedf6a8e5807b76ff8d23ea6e47c3fa5082 tint: Have ast::DiagnosticControl use ast::Identifier by Ben Clayton <bclayton@google.com>
  - f031ca2d440d22d194d67d3c28ff1ae06c6a7a59 tint/hlsl: fix assignment to matrix element by Antonio Maiorano <amaiorano@google.com>
  - a4117ca21bbd6e8b87e810f9e35d47860cf07a59 tint: Have ast::MemberAccessorExpression use ast::Identif... by Ben Clayton <bclayton@google.com>
  - 6cba18b0fc998ebb9d7a23cbb88a179b9718cc8c tint: Have ast::IdentifierExpression use ast::Identifier by Ben Clayton <bclayton@google.com>
  - 999db74a24031f54f0741285d7fa47bb8a56f2b0 tint: Have ast::CallExpression use ast::Identifier by Ben Clayton <bclayton@google.com>
  - 6e31bc24b139b2ac3ab83297f1e5eecac566e185 tint/parser: Use = for source of assignment by James Price <jrprice@google.com>
  - c87b1fe8c96efd1661551d0e4e87c1ddf5fa0ec3 tint: Add ast::Identifier by Ben Clayton <bclayton@google.com>
  - 92226dbfc371a52fd54e90486ab27f00e97b8a2b tint/reader/wgsl: Add source info to loop bodies by James Price <jrprice@google.com>
  - f6a48ee3519740f88d35f4a82a28648e495b2648 tint/reader/wgsl: Add source info to compound statements by James Price <jrprice@google.com>
  - 70f968d098c8cb914f4fc55766e1611513d5370e tint: Fix masked ParameterRequiredToBeUniform by James Price <jrprice@google.com>
  - 072f83c68257ec36ef3113b21eb765ce9f519da7 tint/uniformity: filter should not affect result by James Price <jrprice@google.com>
  - d9f659670d1d72d33a803029729a7cbb6eb275cc tint: Handle @diagnostic on block statements by James Price <jrprice@google.com>
  - eab1f626295c64225e95862b35e2a359559bbdc7 tint/hlsl: for default-only switch, only emit condition i... by Antonio Maiorano <amaiorano@google.com>
  - 635c5d0f04967d0e410ecd9e47d9db47ded67f9f tint/spir-v backend: emit OpSRem instead of OpSMod for re... by Antonio Maiorano <amaiorano@google.com>
  - f374b819d95be3424e9a99af282db1fb81328d6e Remove `sig` deprecation. by dan sinclair <dsinclair@chromium.org>
  - 97ad405216b228451af785cb0f1605a709b686d2 Fix MSVC 14.29 errors: by Corentin Wallez <cwallez@chromium.org>
  - 7ce72de3a592c5340e62efa35dec526e5999845f tint/renamer: Preserve diagnostic control names by James Price <jrprice@google.com>
  - ab52881bb53b16a920df45e524eb6f9345d1f05a tint/validator: Test @diagnostic on invalid places by James Price <jrprice@google.com>
  - 2f2400bfdcd4831c89806928df37ac48ae715b37 tint/validator: Check for conflicting diagnostic controls by James Price <jrprice@google.com>
  - 2dbb7b4f6a1cbff1629cf77513411d0dc466e15e tint/SingleEntryPoint: Handle diagnostic directive by James Price <jrprice@google.com>
  - 1226320a5b1a028b1e55c045fdfc248540fe1e53 Move ast_type.cc to type.cc. by dan sinclair <dsinclair@chromium.org>
  - 3076a8bf178eb09dde5e47461b8f4e8f65cf9cd9 Add missing sem headers by dan sinclair <dsinclair@chromium.org>
  - 1a26e80318b096d818f1042e095111c861bb7a29 Create a libtint_ast_src. by dan sinclair <dsinclair@chromium.org>
  - a3e90618dcde761436f656f44333020506f0cb32 Remove libtint_core_src. by dan sinclair <dsinclair@chromium.org>
  - 186fdaf815a040344daa38b47bd383acb5586e46 Rename libtint_core_all_src to libtint_syntax_tree_src by dan sinclair <dsinclair@chromium.org>
  - d108693b5994198f3a4b454637adc31d820be498 Move a few more headers to base_src. by dan sinclair <dsinclair@chromium.org>
  - b560dcdb9fa2d49baa2ab9608904f22b97b0c8ca Pull inspector out to gn source set. by dan sinclair <dsinclair@chromium.org>
  - 2da119a0ce501ca982a460c77d57ff9ae4f5c479 Split constant and type out of libtint_core_all_src by dan sinclair <dsinclair@chromium.org>
  - 58dd079e466579f5c4c5fe35d41aff9bd16cd555 tint/resolver: Warn for unknown diagnostic rules by James Price <jrprice@google.com>
  - f629770bcdabe8c1efe550ff5efc3df7f6ce47a1 tint: Move "suggest alternatives" logic to utils by James Price <jrprice@google.com>
GitOrigin-RevId: 95dc1ad0601538ecb5744d944bca90d325183056
Change-Id: I0b64e60d7099551701cd5ececfb2f038ca9dd452
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/120160
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
494 files changed
tree: 96952b6f7df936bb25a8317717641a4d66524ab8
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. src/
  8. third_party/
  9. tools/
  10. .clang-format
  11. .gitignore
  12. .gn
  13. AUTHORS
  14. BUILD.gn
  15. CMakeLists.txt
  16. CMakeSettings.json
  17. CODE_OF_CONDUCT.md
  18. CPPLINT.cfg
  19. DEPS
  20. Doxyfile
  21. LICENSE
  22. OWNERS
  23. PRESUBMIT.py
  24. README.md
  25. standalone.gclient
  26. tint_overrides_with_defaults.gni
README.md

Tint


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.

Requirements

  • 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)

Building

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 https://dawn.googlesource.com/tint 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/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.

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

Issues

Please file any issues or feature requests at https://bugs.chromium.org/p/tint/issues/entry

Contributing

Please see the contributing guide in the Dawn repo.