Import Tint changes from Dawn

Changes:
  - 7981507e005036b20d2df0d6a76329c26d69ec0e spirv-reader: support OpSRem by David Neto <dneto@google.com>
  - 0ceaaa56cbb08e5058212d2d3646c6ecb19ae04c Fix interpretation of depth operand in SPIR-V reader by Alan Baker <alanbaker@google.com>
  - 1db4354069d19fbc44335d245fe6bd57341d2881 Metal: Support feature chromium_experimental_dp4a by Jiawei Shao <jiawei.shao@intel.com>
  - 05d278e1676a5ec13bc8e0d31ce0f7e83abe512a Revert "Switch to C++20 for CMake builds" by dan sinclair <dsinclair@google.com>
  - b0dfccdfc36f7ef237a9cbc20b186023a70b1a4b tint: workaround DXC bug with splatted vector constant te... by Antonio Maiorano <amaiorano@google.com>
  - 9dffe91f6a4f715007a2e949dfca94eb02077479 tint_cmd: force DXC to use HLSL 2018 like Dawn by Antonio Maiorano <amaiorano@google.com>
  - 3aea52329800f6f08a2c89576cbcfb524fd9205a [glsl-writer] Fix several bugs about storage image by Jiawei Shao <jiawei.shao@intel.com>
  - 59269a20da89ad3a6d2af3f927584b1ab026650d Pass TextureBuiltinsFromUniformOptions. by Stephen White <senorblanco@chromium.org>
  - 6f992507064eaacc9494ed4fc258f0f6223205ef spirv-reader: test multiple barrier emission when flags a... by David Neto <dneto@google.com>
  - fb17bfd98bba75064b04590f7ca71e6e38f8d78e [eval] Make a TransformTernaryElements by dan sinclair <dsinclair@chromium.org>
  - debd8ae995a0ee1128c7b9cca3a1f08a4586b157 [eval] Add a TransformUnaryElement method by dan sinclair <dsinclair@chromium.org>
  - c858b7634b43995887a446c7aabaee2e590beff5 [eval] Make a un-templated TransformBinaryElement by dan sinclair <dsinclair@chromium.org>
  - 7385fbf347f370f1ade238de12798226e33f43d1 [eval] Remove template param from TransformBinaryDifferin... by dan sinclair <dsinclair@chromium.org>
  - 5bffb54609d7a9412a6d64219963af7ab8e8000f [eval] Rename method for clarity by dan sinclair <dsinclair@chromium.org>
  - 269e6ba855d07c9e68b4435e50885b901e65026c [tint][resolver] Fix use after free, causing UA to be ign... by Ben Clayton <bclayton@google.com>
  - aa6769f9ed1f9826f38cdd3bdc65afb603ba714a Switch to C++20 for CMake builds by James Price <jrprice@google.com>
  - 182fb64432bdd064dd9b78b0c88cbe3882c4db0f Bump protobuf version by James Price <jrprice@google.com>
  - 9bbad3481954273541e8b9ea29e4bc45c0fbe78d [fuzzers] Use is_standard_layout instead of is_pod by James Price <jrprice@google.com>
  - f787019f872cf70a4b936b84a2281d245859c8cf [tint] Use INT64_MIN instead of -0x8000000000000000ll by James Price <jrprice@google.com>
  - d104651513e8cd63022dea520b84b11d13fffd95 [tint] Use `auto` for enum class lambda parameter by James Price <jrprice@google.com>
  - 4bb41e7de844decf056e8b6c856cad87fa72dfb4 [kokoro] Switch to Clang 13.0.1 by James Price <jrprice@google.com>
  - 57ded6a946f51c25557b990ff7ba89223b2ee1f3 [tools][gen] Describe how to regenerate files in the header by Ben Clayton <bclayton@google.com>
  - 30b420d5ed210cc014d69c8014853bbf9ab76650 [tint][build] Make <thread> an external library by Ben Clayton <bclayton@google.com>
  - de3e87384a31e60c135b25b0642b8c90fbe274ea [tint][build] Move 'externals.json' to src/tint. by Ben Clayton <bclayton@google.com>
  - e977f5405fe93b1c39148e732aafa21c81e58322 [tint][build] Make msl_metal.mm build for GN by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 7981507e005036b20d2df0d6a76329c26d69ec0e
Change-Id: I93bae831c0ca6ca57c3dcd072c55e0fab844f8c9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/148340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
239 files changed
tree: ebb266b0bd7025a45714dd46eb130f567e4d860e
  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.