Import Tint changes from Dawn

Changes:
  - 1f236ba13f56a2cf588662fe0dc8c28e95e7eb06 [tint] Header-build fixes by Ben Clayton <bclayton@google.com>
  - 0e1a335bca4d455664b616a5a3bd63c99b5da78f tint: Add inspection of pixel_local var member types. by Corentin Wallez <cwallez@chromium.org>
  - d6f6f005b3d0c0b5bbb175a500df8e638fd7ea81 tint/hlsl: fix RemoveContinueInSwitch transform to handle... by Antonio Maiorano <amaiorano@google.com>
  - 932aa8d9bdbc8b407f87c7603fe40ab8ab5e6038 [fuzzers] Do not fuzz IR->MSL yet by James Price <jrprice@google.com>
  - fd8a4fd3925942ad96e1fcfe933af9452d9ef399 [fuzzers] Skip clamp_frag_depth + push constants by James Price <jrprice@google.com>
  - 94a6a818d57cd9e0d1be58f4ea896f5bedc4f58d [ir] Validate builtin return types by James Price <jrprice@google.com>
  - 26c29b7adf7f5e1af71d868d88396f8dc59d6a37 [tint][msl] Support pixel_local attachments by Ben Clayton <bclayton@google.com>
  - 538b3b52ad803690c63e0036aec59514922748db [tint][wgsl/writer] Print even on diagnostic errors by Ben Clayton <bclayton@google.com>
  - a4ad8e7c863944e0360a53cc9b04c05781b630c9 Compat: Make vertex_index/instance_index take an attribute by Gregg Tavares <gman@chromium.org>
  - 0a9d5363cc80e5012b5305f8a086c5404cad069f [ir] Make Robustness ICE for ignored bindings by James Price <jrprice@google.com>
  - 6367c8c43399171544f28722d0d7cdf94a314e6d [ir] Disable runtime-sized array clamping by James Price <jrprice@google.com>
  - 4e6f10fe26cb47222d53b3dbc089720314ef7a7b [ir] Add robustness for texture builtins by James Price <jrprice@google.com>
  - 18e089f18ce028fd1ca85a07874269ba74128737 [ir] Add Robustness transform by James Price <jrprice@google.com>
  - 797063c91dc2542776d150ea5a3c856c4702317d tint: Move inspection of workgroup_storage_size to the en... by Corentin Wallez <cwallez@chromium.org>
  - ecd562000d8105c4366bdab02ce8c90ef29071ae tint: remove the unused Inspector::GetStorageSize method. by Corentin Wallez <cwallez@chromium.org>
  - 656255591ca485191ab95a46215411797ad69475 [tint] Add BUILD.bazel files for Tint by Ben Clayton <bclayton@google.com>
  - 4e800c45d5b42e2051be542601c6eed5595065c0 [tint] More tightly constrain pixel_local use by Ben Clayton <bclayton@google.com>
  - 56e31f92052cf038cac7164fc2d957bdb8342b04 [tint] Remove redundant 'case' statement by Ben Clayton <bclayton@google.com>
  - 4604ea84b4b7ce727f2bcc32cf7d4584c84508b5 [tint][msl] Add validation support for 2.3 by Ben Clayton <bclayton@google.com>
  - 7541f3b9eaf1b35aba01f476b0e6925b508e3554 [tint] Rename tint_enable_local_storage_extension -> tint... by Ben Clayton <bclayton@google.com>
  - f7c0ede118e2951cecad53ab9aa74f499591cc0e [ir] Move select over to spirv builtins. by dan sinclair <dsinclair@chromium.org>
  - 669edf7eba06cd8c91d47e45d9e2f4afeab814b5 [ir] Move dot over to spirv builtins. by dan sinclair <dsinclair@chromium.org>
  - e9fe772be150b105ef9e2d91c56d85070bb1d496 [ir] Move atomics over to spirv builtins. by dan sinclair <dsinclair@chromium.org>
  - 721f6389050a1be352beb7372d6d1f0281ec6416 [ir] Move array_length intrinsic to a builtin by dan sinclair <dsinclair@chromium.org>
  - 18909c6e1f419225d4b8585a07b2f2e8f54f6412 Add tint.natvis to CMake and fix outdated visualizers by Antonio Maiorano <amaiorano@google.com>
  - e1c1f0ded0da91ad0b66a8618765db1c9bdb8b2f [ir][spirv-writer] Handle storage texture loads by James Price <jrprice@google.com>
  - ddffd5e3968d5f5e6dd90e7660b186d4f0df5886 [ir] Move matrix and vector intrinsics to builtins by dan sinclair <dsinclair@chromium.org>
  - 759dfc685678005b43bbcd3ff7d5a8ebbc295545 [tint] Polyfill bgra8unorm textureLoad results by James Price <jrprice@google.com>
  - 51db5cf955fec2c70c0084fa1938ce8ef9fcd0d5 VarForDynamicIndex: Skip unevaluated expressions by James Price <jrprice@google.com>
  - b88e1c7c339853fea31bd5209a5dd71066c6a903 [ir] Validate spirv builtin calls by dan sinclair <dsinclair@chromium.org>
  - 65a18313e1091109b7e6e290825cbafdec22775c [tint] Support sparse .def files by Ben Clayton <bclayton@google.com>
  - c7d70317eb4ca783ee56f288eb83b67806f930f3 [tint] Validate 'pixel_local' pipeline stages by Ben Clayton <bclayton@google.com>
  - 14500bc78ca76971f77eb52a4e33dd9c20e6ed84 Tint/Dawn: SPIRV AST writer to support experimental subgr... by Zhaoming Jiang <zhaoming.jiang@intel.com>
  - 3b4b3fdec2b74b02751dedc232fc3e9c4cf28dae [ir] Remove the build ir flags by dan sinclair <dsinclair@chromium.org>
  - 8d733d3f2eb5f0b4406de896b529f7803b4d96f6 Move intrinsic table methods to free functions. by dan sinclair <dsinclair@chromium.org>
  - d305da9acec395be2ae02bb9c66fe1b5196245a6 [tint] Move GLSL AST transforms to lang/glsl/writer/ast_r... by Ben Clayton <bclayton@google.com>
  - f52f569d040e8c6ebb5998b04820b75150fdb412 [tint] Move MSL AST transforms to lang/msl/writer/ast_raise by Ben Clayton <bclayton@google.com>
  - c706b4bb571d4a6e3c6f9c5febe07a4ddd0cf7b6 [ir] Move spirv.def file. by dan sinclair <dsinclair@chromium.org>
  - 774b6a4c44a10f14da7405a0c21548428a9ef3f8 [ir] Add a SPIRV BuiltinCall instruction by dan sinclair <dsinclair@chromium.org>
  - d8a06aed62152e36d4a0c9025100b77407f789f8 [ir] Use FriendlyName for instructions by dan sinclair <dsinclair@chromium.org>
  - 3047f882319f43577a01c6a9882b64e9fcd1ad30 [tint] Move SPIR-V AST transforms to lang/spirv/writer/as... by Ben Clayton <bclayton@google.com>
  - 815d5db31ff56228ff8f67e8504ccc8d9586712c [tint] Move SPIR-V AST transforms to lang/spirv/writer/as... by Ben Clayton <bclayton@google.com>
  - 7a5f54eafc202b9c51cefae379f9e63fcbd14dcd [tint] Move HLSL AST transforms to lang/hlsl/writer/ast_r... by Ben Clayton <bclayton@google.com>
  - 032c1403099cb1a02ef63e8068d28d282d76258a [ir] Move SPIR-V IntrinsicCall to out of ir by dan sinclair <dsinclair@chromium.org>
  - 1997409ad728cc0dcaba4245ff1961575a477848 [tint] Validate 'pixel_local' data types by Ben Clayton <bclayton@google.com>
  - 6cd15d28f2cda74b909c7f270069609ffab0b8e8 [tint] Add 'pixel_local' address space by Ben Clayton <bclayton@google.com>
  - 59f488872a6e8e4e8311394c5ae778d9c627d375 [tint][cmake] Fix TINT_BENCHMARK_EXTERNAL_SHADERS_HEADER by Ben Clayton <bclayton@google.com>
  - 6a56e27e446a266b1a57fa8840ad4e95c3470b2b [tint][ir] Validate builtin calls with the intrinsic table by Ben Clayton <bclayton@google.com>
  - d1368d7cfc777145c8ab83d81f2b59e29793f106 tint: workaround DXC bug with splatted vector constant st... by Antonio Maiorano <amaiorano@google.com>
  - a985f73277b71dd33393652d011e9389640bfe02 [tint] Reflect missing writer options by James Price <jrprice@google.com>
  - f3bcd41e7e96b02875dc9893c6cf57821d472658 [tint][hlsl] Fix validation on unix by Ben Clayton <bclayton@google.com>
  - 89b98283a31c166cd31458350b6e0d1131bb13a5 [tint][build] Link CoreGraphics for metal validation by Ben Clayton <bclayton@google.com>
  - 6c3d888f6340d13df5b4e4fdb492b4d2062bf564 [tint][cmake] Error if building fuzzers without Clang by Ben Clayton <bclayton@google.com>
  - 4ebed9da86ac0c703beee8fd083b6146355c3285 [tint][ir] Move Validator class definition into cc file by Ben Clayton <bclayton@google.com>
  - 62ce2929c61810d2bd6b67cb516e114618f8c991 [tint][glsl] Use CheckSupportedExtensions() in writer by Ben Clayton <bclayton@google.com>
  - 74688c954b958a1b606ce1328c8946058adfb66b [tint] Add 'chromium_experimental_pixel_local' extension by Ben Clayton <bclayton@google.com>
  - b6f45484545f685dca85cad9b18dd8f0953840eb [tint][utils] Remove pointless nullptr check in vector Fr... by Ben Clayton <bclayton@google.com>
  - b6ef5273e530e6186ce6545551ae79d65d4fcbc8 tint/fuzzers: Move specializations out of class scope by Ben Clayton <bclayton@google.com>
  - ba982f25792d4b11f669b1e6b015ec1ff9809f4e clang-format codebase by Ben Clayton <bclayton@google.com>
  - 385155300519e4580d2c1312446701e0d66b4aae tint/spirv/writer: Disable GCC false-positive warning by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 1f236ba13f56a2cf588662fe0dc8c28e95e7eb06
Change-Id: I63c6bfb26a71b91ceef14c1886ce28c9ac9c303e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/149980
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
413 files changed
tree: a322c40167f2fd19f893d964fbaeb7647dc8430e
  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.