Import Tint changes from Dawn

Contains manual fixes for:
 * CMakeLists.txt
 * DEPS
 * scripts/tint_overrides_with_defaults.gni

And one new files:
 * third_party/protobuf.cmake

Also bumps Kokoro Clang version to 13.0.1, to match the Dawn bots.

Changes:
  - d86e9a765cb57b9e3c8476731a4de964e2dd25a3 [spirv-reader] Pass workgroup_id as argument by James Price <jrprice@google.com>
  - 3f11e1e7dff3c0a0a0ecc6d3ae23f9070f4c0aa8 [tint][ir] Serialize Swizzle instruction by Ben Clayton <bclayton@google.com>
  - 59bc89f8fe3967eee8eef4465eea31dc22fe1a79 Revert "clang-format" by Stephen White <senorblanco@google.com>
  - f91e88ad4a2306f6b65dd97849d33a2c515af6ac clang-format by Ben Clayton <bclayton@google.com>
  - 84a7cbf8ebc415970472d2b32eaef27a417b59bc [tint][ir] Serialize [Load|Store]VectorElement instructions by Ben Clayton <bclayton@google.com>
  - 53c0fa9a80310e69b5b1b6cae96f9469f20b654e Enable language extension `packed_4x8_integer_dot_product` by Jiawei Shao <jiawei.shao@intel.com>
  - c668c1690ed23db80238aabbe42002a15ee2eb0e [tint][ir] Serialize Unary and Binary instructions by Ben Clayton <bclayton@google.com>
  - dacc2637282217ac5d9a2c2a45a7ca2c54dbac61 [tint][ir] Serialize Var binding points by Ben Clayton <bclayton@google.com>
  - 7d9a66e3d2a562819b750d4aa1bdbb912de770b5 [tint][ir] Serialize the root block by Ben Clayton <bclayton@google.com>
  - cba30d2b886939bc7b84f7b5687236ff9ca83046 [tint][ir] Serialize Load and Store instructions by Ben Clayton <bclayton@google.com>
  - 112549bea523b3cfc1c2c0e0f37b2e2f442f2ca5 [tint][ir] Serialize UserCall by Ben Clayton <bclayton@google.com>
  - 0bc302670162c75ef9417f4e1c3d775bc96cdaa0 [tint][ir] Serialize fixed-size array types by Ben Clayton <bclayton@google.com>
  - 7f9721daadcf26d752f56847ff319644d1c5913e [tint][ir] Serialize var instructions and pointer types. by Ben Clayton <bclayton@google.com>
  - 3f620ab5d809ad4c2b90a165a1ec4241dbbb7913 [tint][ir] Serialize Access instructions by Ben Clayton <bclayton@google.com>
  - fc5664ab75a62d969cdc4d3870a073bf4ba5e0c4 [tint][ir] Serialize vectors and matrices by Ben Clayton <bclayton@google.com>
  - 069238f0d8b1eee5daaff62a7f5978f69dcab954 [tint][ir][validator] 'source' -> 'instruction' by Ben Clayton <bclayton@google.com>
  - 4eff8bec72c2900d4a8b9219535433016ceef279 [tint][ir] Serialize constant scalars and lets by Ben Clayton <bclayton@google.com>
  - 85b673578773a7104615183fce70b0dbf6462d58 [tint][ir] Serialize Discard instructions by Ben Clayton <bclayton@google.com>
  - 2388287c0ecacdb37a09ab2b73f10a7c66eff7bc [tint][fuzz] Don't attempt to memcpy from nullptr by Ben Clayton <bclayton@google.com>
  - 3ee81db189e8e5cebbec8c6f33f9d15e9124ed67 Fix license: it's BSD-3 not Apache 2 by David Neto <dneto@google.com>
  - 0a8dc81b6184478c1b4c83bda1ecb71da660bb04 [tint][utils] Make bytes::Reader an interface by Ben Clayton <bclayton@google.com>
  - 44a29b5e3743ad38a8d5147119471d28fabd44e5 [tint][gn] Fix include_dirs in tint_common_config by Ben Clayton <bclayton@google.com>
  - ae7240f3642136f636a49d07dfc1c87cd29cf0b9 Vulkan: Use the polyfill of dot4{I|U}8Packed() when neces... by Jiawei Shao <jiawei.shao@intel.com>
  - 648a2b32c94e2bbda7f12076ff57ace9699e602e OpenGL: Support dot4I8Packed() and dot4U8Packed() by Jiawei Shao <jiawei.shao@intel.com>
  - 90c7cc2304a6b629e5c5fdef18b4e1a1b3a2fbaa [tint][ir] Begin building proto-based serializer by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: d86e9a765cb57b9e3c8476731a4de964e2dd25a3
Change-Id: Ib656c7a3768d7a278d640f35ce2534b8c50f73d2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/165140
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
110 files changed
tree: 8e4bad8b7df78c677b1289487ab6af8ac3191d16
  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.