Import Tint changes from Dawn

Changes:
  - f55d13b7544c04210550d51ec20d3f6ef81ba835 [ir] Add increment and decrement statements. by dan sinclair <dsinclair@chromium.org>
  - 0e6534e44d2c3c77ac409d787d9d5b3d449a2d0a [tint] Make Transform base class by James Price <jrprice@google.com>
  - a6d8e8137101746de775c45915b43c5b4730715e [ir][spirv-writer] Implement binary subtract by James Price <jrprice@google.com>
  - 9940c7bdccca0826cf27b2a20da5b590200c811a [tint][ir][ToProgram] Stub ToProgram() by Ben Clayton <bclayton@google.com>
  - 0df7f8bccd74f2c9fd07e5bc65f08bfabc2f3845 [ir] Update disassembly output. by dan sinclair <dsinclair@chromium.org>
  - 11bd8a012faa4a56a272f73109908c2720f2e329 [ir] Fix scope stack for loops. by dan sinclair <dsinclair@chromium.org>
  - 055de2744101630570b257d8a1583cabaa986c24 [ir][spirv-writer] Emit vector constants by James Price <jrprice@google.com>
  - 2f324c59ffbec46a5c5e3b3f21b7dace177f0907 [ir] Remove list of entry points from module by James Price <jrprice@google.com>
  - f59547fb7f1ca6d7cc3fc357020af02d94d68a8b [ir] Add optional CreateFunction parameters. by dan sinclair <dsinclair@chromium.org>
  - 69b5900c88bbc478c2a03d395b42593e833e609c [ir] Use the branch helper in the spirv tests. by dan sinclair <dsinclair@chromium.org>
  - 34c794e2e9476bd5338bc1ba548d7dc3dc59352b [tint][ir] Shuffle and refactor from_program.cc by Ben Clayton <bclayton@google.com>
  - 8d98977a30b7c00ffacad47322a1ba0f896b3ad8 [tint][ir] Make the ir::BuilderImpl PIMPL by Ben Clayton <bclayton@google.com>
  - c9dd75a0e9cd6597539c8b2d06a73636905ab266 clang-format by Ben Clayton <bclayton@google.com>
  - c9923d2ee3bc5ae541052176320e30aa3d8d6d43 [ir] Set default flow node values. by dan sinclair <dsinclair@chromium.org>
  - 809187c57968e5ee1748fb1b661e46cc9f691093 [ir] Move ir::Builder to hold module reference by dan sinclair <dsinclair@chromium.org>
  - 36aa48ce36053a10993f6eae1ad1224b7a912abf [tint][ir] Clean up tests by Ben Clayton <bclayton@google.com>
  - 8370ddddc58a6fdc5a3e9f688da909352164351b [ir][spirv-writer] Emit vector types by James Price <jrprice@google.com>
GitOrigin-RevId: f55d13b7544c04210550d51ec20d3f6ef81ba835
Change-Id: Icb27f15ec5162714de7d909637103f195a4b6194
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/133040
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
92 files changed
tree: d6b6cbd366f25002dbc0d4b769d6089cbc91b33b
  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.