Import Tint changes from Dawn

Changes:
  - 2e11963cafd801f8749609cd5c00250b664312a5 D3D12: Skip robustness transform on textures by Jiawei Shao <jiawei.shao@intel.com>
  - 3ef08efc818b130e5aa46bb0c23fcbcec3b4d2c3 Add Partial Tint Dual Source Blending Extension by Brandon Jones <brandon1.jones@intel.com>
  - 4dc97b404b088d3094f04ed08ec002e53d29f220 [ir] Add a helper for creating struct types by James Price <jrprice@google.com>
  - 9397714f67830d5745c3bb871e51e5bb3f857470 [tint][ir] Rename Case::start -> Case::block by Ben Clayton <bclayton@google.com>
  - c8f07088e47520a6d20efe9a7929c35c2c1c2c52 [tint][ir] Make ControlInstructions regular instructions by Ben Clayton <bclayton@google.com>
  - 2649bd008951a70fd0472dede0df517ab5d5eed8 Vulkan: Skip image robustness transform with VK_EXT_robus... by Jiawei Shao <jiawei.shao@intel.com>
  - 5702df1d368de93eddebb815b482567bd48f39c1 [spirv-reader] Detect constant vector splats by James Price <jrprice@google.com>
  - 4915adcccaf98049d9e03e7306d03eec1c598310 [tint][ir] Add Unreachable instruction by Ben Clayton <bclayton@google.com>
  - 1104ad1c9b9108a0e25fee0ad53b0f6b9cbe489a [spirv-reader] Emit zero value constructors by James Price <jrprice@google.com>
  - e38419aac1628f5a012fe47dadb3e3d1f70490ea [spirv-reader] Detect vector splats by James Price <jrprice@google.com>
  - 80f0a172352efeadfdaaa7e4da303c5101579a76 [spirv-reader] Emit multi-component swizzles by James Price <jrprice@google.com>
  - b62d00861d4823e9f072f998239343ae7f31239b [tint][ir] Add Instruction::Destroy() by Ben Clayton <bclayton@google.com>
  - ab0cbed26bb0cb086734dcca58db9aace020d5b7 [tint][ir] Add Destroy(), Alive(), ReplaceAllUsesWith() t... by Ben Clayton <bclayton@google.com>
  - a059e59780d140490a337377bcd4f00b28923d50 [tint][ir] Add Builder::Exit() helper by Ben Clayton <bclayton@google.com>
  - 27c6d9801ab38f1b6ef7b21003ac1cc52641325d Add static assert: const-eval depends on inf and NaN supp... by David Neto <dneto@google.com>
  - c801286132eff43707a13fad9867b163beef8cb8 [ir][spirv-writer] Enable capabilities for F16 by James Price <jrprice@google.com>
  - 4187a53d41dc8e5d8bd8344a07e70554990e097f [ir] Validate transform test input and output by James Price <jrprice@google.com>
  - b13184bb85a1a4b2d5047b6c751b1b0c3ce0aa35 [tint][utils] Add Any(), All() and list ctor to Hashset by Ben Clayton <bclayton@google.com>
  - afa5617f6fd288a16b7755aa03dbafe330216ec4 [ir][spirv-writer] Add MergeReturn transform by James Price <jrprice@google.com>
  - aabfc4d85bc39c3ff28670d22cfada276b94860a [ir][spirv-writer] Emit construct instructions by James Price <jrprice@google.com>
  - 0d80c3d66152a0211cd64c08929335cc520d23cd [ir] Sever instruction and value. by dan sinclair <dsinclair@chromium.org>
  - 367fad852a6c48f9b0691d756c2fe7150c056ead [ir] Spit `instruction` and `value` allocators. by dan sinclair <dsinclair@chromium.org>
  - 525b6f5f76e2ddad10c4aa6e3b261d58bfa05a4b [ir] Add Result objects into the instructions by dan sinclair <dsinclair@chromium.org>
  - 4934dc0544f8d39db30f791337fbcf94b8c9301c [ir] Update `Value` parameters. by dan sinclair <dsinclair@chromium.org>
  - 138d5b7b9f6f2e394b95b040ffd7b041cbba7831 [tint] Move 'using namespace' into anonymous namespace by Ben Clayton <bclayton@google.com>
  - b839f673ac7a118aac551959d118aa61b0d77fb6 [ir] Make function an operand of return by James Price <jrprice@google.com>
  - 66805b0c0e45eaf4ef95d60d26c32b16ff6ae639 [tint] Migrate to 'fluent types' by Ben Clayton <bclayton@google.com>
  - a3390da8f5a22a23bf490e3d0fcfc147e73ba905 [ir] Add Return::Value() to get the return value by James Price <jrprice@google.com>
  - 19f92f9cdeab4e4f888d78ad7a3fd5819fdc2a7d [ir] Convert tests to block builder. by dan sinclair <dsinclair@chromium.org>
  - 2ef231183fbaf6e2315891257eb72b0a2071739e [ir] Allow builder to auto-append instructions. by dan sinclair <dsinclair@chromium.org>
GitOrigin-RevId: 2e11963cafd801f8749609cd5c00250b664312a5
Change-Id: I51fe8a11246dfafc61a9551dc7f6d23870ace1a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/137400
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
296 files changed
tree: 8c9810ef6670de1d3b7d312aa18385d1e21a6535
  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
  27. 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.