Import Tint changes from Dawn

Changes:
  - 4b452dc88a133cd21bd0af9287e7267145a13e6b [tint][core] Remove UnwrapRef() calls from intrinsic::Tab... by Ben Clayton <bclayton@google.com>
  - b91578ac795715992d291da26f614b6ce3b106bf Fixup remapped binding group for MSL options. by dan sinclair <dsinclair@chromium.org>
  - 6b718aa2b08bffcb9bf4ef4c2d1fbc04fac32317 [tint][ir] Fix unittests that used invalid binary-ops by Ben Clayton <bclayton@google.com>
  - 5ae7a137676a258a00d699b1e22bdede68f1c430 [tint][ir] Rename shiftl -> shl, shiftr -> shr by Ben Clayton <bclayton@google.com>
  - 30404595c85eea98d231b7c68e1f21a24cc03167 [tint][utils] Add bytes::Decoder support for optional and... by Ben Clayton <bclayton@google.com>
  - ebaf1174d90011de3724427a4ea0ef3c6e7d9e9d Fix syntax tree build. by dan sinclair <dsinclair@chromium.org>
  - ffefb48bb51ff8e5445d1efa11b920e74874125c [tint][core] Add MemoryView type by Ben Clayton <bclayton@google.com>
  - 8962cdd9051f3569b8ec5d7c44ff524fb9054e61 [tint][utils] Add TINT_REFLECT_ENUM_RANGE by Ben Clayton <bclayton@google.com>
  - 10c56f6efad017ac4fbee7e94c885a18488db635 [tint][ir] Serialize DepthMultisampleTexture types by Ben Clayton <bclayton@google.com>
  - a35b8d46adae9a2b95be39f1a30904309c6b0c00 [tint][ir] Serialize Unreachable instruction by Ben Clayton <bclayton@google.com>
  - 4c87ddf16dc7a506a015f7111c5572b8da3d7bee [tint][ir] Serialize MultisampledTexture types by Ben Clayton <bclayton@google.com>
  - fc24576d41ffb0e027d99f6ac6872d6773ce05d3 [tint][ir] Serialize Bitcast instructions by Ben Clayton <bclayton@google.com>
  - 07177d5d9d7a348b481eb32adc9fed2056950b70 [tint][ir] Serialize ExternalTexture by Ben Clayton <bclayton@google.com>
  - 7f4129354f1c08649ca8600c96e356283a86bf5c [tint][ir] Serialize more function return attributes by Ben Clayton <bclayton@google.com>
  - 3b0e5df0e510e43b9c6b58e3ce9a11d136aa41b4 [tint][ir] Remove Function::ReturnBuiltin, use core::Buil... by Ben Clayton <bclayton@google.com>
  - e8b7b02cbd6e20b5f247a88dabe12dc25e586a76 [tint][ir] Serialize function parameter attributes by Ben Clayton <bclayton@google.com>
  - 8c9411653c73c26265cc2175a608a20c444bcc22 Move new WGSL AST fuzzer. by dan sinclair <dsinclair@chromium.org>
  - f7c844b26baa8431462a4ddcd3c6602578842d2f msl: Explain side-effect annotation in preserved loops by David Neto <dneto@google.com>
  - a011704b230c4fe0c076b53e4a9eb9b14e57beb6 [tint][ir] Remove FunctionParam::Builtin, use core::Built... by Ben Clayton <bclayton@google.com>
  - c9115e1bd338325c4f91b5043077fa0e8e6a56bd [tint][type] Fix runtime-sized array implicit stride by Ben Clayton <bclayton@google.com>
  - 89274f7f65d20acb7292007f1f77858547b34ec9 [tint][utils] Remove boolean operators from Result by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 4b452dc88a133cd21bd0af9287e7267145a13e6b
Change-Id: Iffb2ccc6cb0de139e1e5c078f11e6fd26c0fe50a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/168100
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
162 files changed
tree: 4d50952e6ee81c6f61b67309d1a436f09c16351f
  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
  14. AUTHORS
  15. BUILD.gn
  16. CMakeLists.txt
  17. CMakeSettings.json
  18. CODE_OF_CONDUCT.md
  19. CPPLINT.cfg
  20. DEPS
  21. Doxyfile
  22. LICENSE
  23. OWNERS
  24. PRESUBMIT.py
  25. README.md
  26. standalone.gclient
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.