Import Tint changes from Dawn

Changes:
  - 36589ed1e5b097b3bff70d9fc78d87d095e673dd [tint][utils] Make it more likely for fuzzers to decode c... by Ben Clayton <bclayton@google.com>
  - 71926f1b61d3d450f02d4bb38004efea2bafd22a [tint][sem] Remove unused member variable by Ben Clayton <bclayton@google.com>
  - e050d30803181a8a0c0e34f38715a1b416486dd9 [tint][fuzz][ir] Skip programs that use the framebuffer f... by Ben Clayton <bclayton@google.com>
  - 48de84dfe6458204fe463d1249e336680302ff71 Revert "[tint][fuzz] Enable AllowedFeatures::Everything()" by Ben Clayton <bclayton@google.com>
  - e9aa8c372d01ec8c6312d31193593277cd75afb6 [tint][fuzz] Enable AllowedFeatures::Everything() by Ben Clayton <bclayton@google.com>
  - bc1d5ca8313cbeb054e88386e97f3d72b750512c [tint][fuzz][ast] Add ArrayLengthFromUniform fuzzer by Ben Clayton <bclayton@google.com>
  - fe59714b752b36a012fb328d8de0d2aa68cf6bf2 [tint][fuzz][ir] Add ValueToLet fuzzer by Ben Clayton <bclayton@google.com>
  - 12680c44defe03a180bd3b15260a2c618ef61d02 [tint][fuzz][ir] Add ZeroInitWorkgroupMemory fuzzer by Ben Clayton <bclayton@google.com>
  - 3a4e074edbac10d04e60a2f720756c7fb7e5259d [tint][fuzz][ir] Add VectorizeScalarMatrixConstructors fu... by Ben Clayton <bclayton@google.com>
  - 28afc120e634c1c71ea6f5ad3bc448930e2aa9c6 [tint][fuzz][ir] Add Std140 fuzzer by Ben Clayton <bclayton@google.com>
  - 4241ea260d27c7d578fe0d1657b6be4f76026374 [tint][fuzz][ir] Add Robustness fuzzer by Ben Clayton <bclayton@google.com>
  - 13798bc31d4de2b3da27e76cdd253c219b3149fb [tint][fuzz][ir] Add PreservePadding fuzzer by Ben Clayton <bclayton@google.com>
  - c132ccda7e8ac61fc5a42c7b1bdd3d0fc4a2a44e [tint][fuzz][ir] Add MultiplanarExternalTexture fuzzer by Ben Clayton <bclayton@google.com>
  - a1025ffd8f9bb45b7f8597881de348ea26d58012 [tint][fuzz][ir] Add DirectVariableAccess fuzzer by Ben Clayton <bclayton@google.com>
  - 4ae06486516687352952a4ea1adacdff565926ae [tint][fuzz][ir] Add DemoteToHelper fuzzer by Ben Clayton <bclayton@google.com>
  - 7fa78c5be0a84d5128ada355b2d40c34ca5c81f0 [tint][fuzz][ir] Add ConversionPolyfill fuzzer by Ben Clayton <bclayton@google.com>
  - 2189ab286cef0c8405ccb20bab03615c47b5ed4d [tint][fuzz][ir] Add CombineAccessInstructions fuzzer by Ben Clayton <bclayton@google.com>
  - cb9ccf87002b881cd6fbcddd9db1937220cfd9bd [tint][fuzz][ir] Add BuiltinPolyfill fuzzer by Ben Clayton <bclayton@google.com>
  - f792ce6e091b89be72c660e67bccbdcd9f319d8b [tint][fuzz][ir] Add BlockDecoratedStructs fuzzer by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 36589ed1e5b097b3bff70d9fc78d87d095e673dd
Change-Id: I73c0316bdb08690f72f1c96c8e8f33713ee5c82d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/185560
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
33 files changed
tree: ebfb72b3d1a730fa85347e01f69a630f96d13cea
  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. LICENSE
  22. OWNERS
  23. PRESUBMIT.py
  24. README.md
  25. 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.