Import Tint changes from Dawn

Changes:
  - 659b5b7727d5e1000271fd75ba99bdca2647a54b tint: add const eval matrix accessor unit tests by Antonio Maiorano <amaiorano@google.com>
  - c73d67397624cab512a1bd680370a146a2640a3a tint: add const eval vector accessor unit tests by Antonio Maiorano <amaiorano@google.com>
  - b71898ea30e5b10b7f9e96d80b5944fc14538b91 tint: add const eval array accessor unit tests by Antonio Maiorano <amaiorano@google.com>
  - dfa92a9cb68366a8655ac26b51af0c740bcf9b72 tint: Fix ProgramBuilder::WrapInFunction overload not bei... by Antonio Maiorano <amaiorano@google.com>
  - 64c243e9e675069871cfbb829196be79ca3ebae1 tint: add missing unit tests for const eval vector constr... by Antonio Maiorano <amaiorano@google.com>
  - 6b4622fb0721f08323db2ce576f16f2226439c9d tint: add const eval array constructor tests by Antonio Maiorano <amaiorano@google.com>
  - 906fc9df206d668191e9660a16688e27eb3d97ce tint/uniformity: Add a NameFor helper by James Price <jrprice@google.com>
  - a84ebc3af9c2086581008e7a05444698e1a6eb15 tint: Add forward declaration for CastableBase by James Price <jrprice@google.com>
  - 0244804193ccb20b6bbcc08caa385c72bff9547e tint/uniformity: Avoid string allocations for node tags by James Price <jrprice@google.com>
  - 857b1580c74193cdab72d77583859f5b96cab30f tint/uniformity: Handle pointer uniformity by James Price <jrprice@google.com>
  - 1d77e2531c5e54385fa95608cc4e9f426a5e0bac tint: add const eval of swizzle tests by Antonio Maiorano <amaiorano@google.com>
  - ffb322a096a1d0f1e2166e6e26d86ab36e31dbd6 tint: add bool member to const eval struct member access ... by Antonio Maiorano <amaiorano@google.com>
  - 309b10a8c5f91c671f5bd586001b8a0db8ae61dd tint: add const eval struct zero init tests by Antonio Maiorano <amaiorano@google.com>
  - 0890ecabdae58876413d9b3dff5e13f1d7e8e60f tint: add const eval zero init tests for scalars, vectors... by Antonio Maiorano <amaiorano@google.com>
  - 994b70feb919b49acd46ae5d71a1af5ee3192bd5 tint: add AFloat and AInt const eval scalar constructor t... by Antonio Maiorano <amaiorano@google.com>
  - bc44620d68bc66b1e664269b7365ea162a08b45c tint: implement short-circuiting of const eval bitcast by Antonio Maiorano <amaiorano@google.com>
  - eb34a764a8c486f59f8c50e1faeed8dac04caa7c tint/uniformity: Fix handling of continuing block by James Price <jrprice@google.com>
  - efc9df4695dac323230d37a6868455acd7fda395 tint/uniformity: Fix issues with for-loops by James Price <jrprice@google.com>
  - 056618541fc5502e475e35cbacc10f4985f0eeb9 tint: const eval of bitcast operator by Antonio Maiorano <amaiorano@google.com>
  - ffa83ad1f74d664b4382bf07c4102b6a6ff3a67b tint: make utils::Bitcast not trigger gcc warning by Antonio Maiorano <amaiorano@google.com>
GitOrigin-RevId: 659b5b7727d5e1000271fd75ba99bdca2647a54b
Change-Id: I4562368a6302698b47a28ceeb63c0cebd542f456
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/115320
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
21 files changed
tree: ec5c3374a8e8bd64f816aed95d2c1f621030b335
  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.