Import Tint changes from Dawn

Include manual build fixes after The Great Reshuffle.

Changes: - d42eb93712b5424d9d3144b78628b2d8487d95f4 [ir][spirv-writer] Zero-initialize variables by James Price <jrprice@google.com>
  - f1057f73ff6f88d7ead4799cd9efb05d0d246087 [spirv-reader] Fix normalize for negative scalars by James Price <jrprice@google.com>
  - 0efa31cbd1db9f5279f5810350de8a432b51bf46 [tools] Use new cnf library for conditions by Ben Clayton <bclayton@google.com>
  - ae72b0b2e6e410b0bf4a49bc22d9b642c8262fe9 [ir][spirv-writer] Avoid integer DBZ by James Price <jrprice@google.com>
  - 6663076f288718fcfbe2775393908d1efcacca39 Move tint_overrides_with_defaults.gni in scripts subdir by Ben Clayton <bclayton@google.com>
  - 0781a51490a336b981ec94382d20d74d8ce7a983 [tint][build] Fix GN tint_build_unittests=false by Ben Clayton <bclayton@google.com>
  - 78f028085c47b309fb51c66c5291b5a90da0338e [ir] Add BinaryPolyfill transform by James Price <jrprice@google.com>
  - 3fe6761cac1b2562cac46ec56037b90f1c60fa9d [tint][build][cmake] Drop GN-style target names by Ben Clayton <bclayton@google.com>
  - 321f861c8a94deb6be9c330def1b2cd24d39d09b [tint][cmake] Remove 'no_warning_for_no_symbols' flag by Ben Clayton <bclayton@google.com>
  - 55e6d713ebd5e6b6f9cb3cd36edfdd3b43ae2e9e [tint][build] Add CMake target names to BUILD.cmake by Ben Clayton <bclayton@google.com>
  - 7d81e55842f026e7dc077e1d29e4fa78835a2772 [tint] Migrate GN build over to generated files/deps by Ben Clayton <bclayton@google.com>
  - 7545f9560b3fdb40d5a3ab307785150194009ea6 [tint] Improvements to './tools/run gen build' by Ben Clayton <bclayton@google.com>
  - 38fb812378a9234bb48f5bd0daaf2899eec5cabf [tint][cmake] Give 'cmd' targets a suffix by Ben Clayton <bclayton@google.com>
  - 418ab8ccb83239d1a7ae6ba4c702e71d0bac319e Tint: Support ReadOnly and ReadWrite storage texture in i... by Jiawei Shao <jiawei.shao@intel.com>
  - 5560934ba99c4e9a5e00e702d75c12e207ba3470 [tint][cmake][build] Clean up CMake build by Ben Clayton <bclayton@google.com>
  - ade35e6ab64aad3677eab7d0cace82c40191a048 [tint] Add RW textures to uniformity analysis by James Price <jrprice@google.com>
  - 9b53a0d016695c7ad148904beeb3654ae48be31b [spirv-reader] Add support for textureBarrier() by James Price <jrprice@google.com>
  - a9dff6e28b99da606c4a03671b7e3d8f11792ff2 [spirv-reader] Add support for read-write textures by James Price <jrprice@google.com>
  - 7803cd75ecd62a1ec7d6dc479d558ae84640fc44 [tint] Emit placeholder symbols for all toolchains by Ben Clayton <bclayton@google.com>
  - c1942cf192525e8b243c5e80e765512c4993a8b7 [tint] Move headers from include/tint to src/tint/api by Ben Clayton <bclayton@google.com>
  - 6ea4471fa680982108e0148471005695f2e5a4c4 [tools][build] Track per-file transitive dependencies. by Ben Clayton <bclayton@google.com>
  - 0ca4bc0e5dfd24b03e039c4bd9bfe540f82e3846 Fix -Werror=unused-but-set-variable by Jason Erb <jason.erb@sparist.com>
  - 141d6d051d885d75045e33a55c668e15a0255c19 Fix CMake compilation on macOS. by Corentin Wallez <cwallez@chromium.org>
  - 3a3cb367b7ac89fd5bb6fbb3e5e25cfe70fdf2ae [tint] Migrate CMake build over to generated files/deps by Ben Clayton <bclayton@google.com>
  - 6f138fe8bb6d3266c1d8a61fe230faabcbd7ba2c [ir] Move ir to `tint::core:ir` namespace by dan sinclair <dsinclair@chromium.org>
  - 1cee30fcef16a0b028b2874e58d6c5eb70373c32 [ir][msl] Add a Raise to the MSL IR printer by dan sinclair <dsinclair@chromium.org>
  - b0ea36833098f29b18ee37ecd27d9004d3171084 [tint] Add _test suffix to spv_dump.[h|cc] by Ben Clayton <bclayton@google.com>
  - a87e5d61e526ceec7e3cd9ca85e9464113f61b9b [tint] clang-format and add missing GN dependency by Ben Clayton <bclayton@google.com>
  - 88c231bab264d6c21be32c6ee33932dcf52a0fe2 [tint] Add read-only storage texture builtins by James Price <jrprice@google.com>
  - 6d338a77e102a5a1f32c341f3bbaf3e895018cb1 [tint] Allow read-only storage textures by James Price <jrprice@google.com>
  - 9b213fd22383b97987b26e4e3c1ea13a08c74a7e Add GL_EXT_blend_func_extended When Using Dual Source Ble... by Brandon Jones <brandon1.jones@intel.com>
  - ce6dffe0172ead5bdc417a42270fc762ea04e874 Move Number into core namespace. by dan sinclair <dsinclair@chromium.org>
  - b1cd47d2f17e7cc99f0eb68abd55304b40f096fd [tint] Move tint.cc to api/tint.cc by Ben Clayton <bclayton@google.com>
  - 53b892b0ce47a1efb22670cba65539ce71baaa7a [msl] Fix mask generation for subgroupBallot by James Price <jrprice@google.com>
  - 9141e9175013c53365ac27148ff492d5bf0356a2 IWYU: add cstdint for uint8_t in tint by Stephan Hartmann <stha09@googlemail.com>
  - a9691e1ef6841c9675ffb95134f8bb8319d5257e [msl] Add support for chromium_experimental_subgroups by James Price <jrprice@google.com>
  - 2821c29c9dc633af18ea4fbb644a73d4933c6376 [tint] Add config and markup for the build generator. by Ben Clayton <bclayton@google.com>
  - 96018e5f5ea95f0cf64ad283fc8ca273d72cd963 consteval: -0.0 equals 0.0 by David Neto <dneto@google.com>
  - 7191337086b24b8364c279297234fb75d063099a Return alpha channel for single plane external textures by Brandon Jones <brandon1.jones@intel.com>
  - 80d154d57dd44830e24eb0f84bcdf95b83eb0f1c [tint] Move test and benchmark mains to cmd. by Ben Clayton <bclayton@google.com>
  - 4ead39155c0e9ae7241d120f6eb59ed9122bdd22 [tint][spirv][reader] Add namespaces, move common.h by Ben Clayton <bclayton@google.com>
  - 8c8009bb2020e99699c8faf69f2f3f8b6a11c481 [ir] Test signed coords for external texture load by James Price <jrprice@google.com>
  - e5685e529a59c80da5935b721c4fd6331a34ed79 [tint] Make comment match code by James Price <jrprice@google.com>
  - 348f73ba1876d612a6687a0e16dbc75d0f539138 [spirv-reader] Fix storageBarrier emission by James Price <jrprice@google.com>
  - 884b88964ce3157d7a2d26dc5876f6390012ae7a [ir][spirv-writer] Support read-write textures by James Price <jrprice@google.com>
  - 05c839634ba216dcaa4caf6754c593a54b168de0 [msl-writer] Add support for read-write textures by James Price <jrprice@google.com>
  - 49ba6bde36a402da58d4f404bf5337d6b3cd0e29 [ir][spirv-writer] Clamp frag_depth if requested by James Price <jrprice@google.com>
  - 5852336cd095637d86ea62453aba93101af7a9ac [ir] Add MultiplanarExternalTexture transform by James Price <jrprice@google.com>
  - a6287df9821f76a914ba7376537595cff669990c [hlsl-writer] Add support for read-write textures by James Price <jrprice@google.com>
  - 1ffc598d1647020a69665d6bbff4dba38240bb12 [spirv-writer] Add support for read-write textures by James Price <jrprice@google.com>
  - 79f4a07947f00a7b26beeaacba7540532eb3fcc8 [tint] Add textureBarrier() builtin function by James Price <jrprice@google.com>
  - 503e0176b2d5467f82d8c9b66d3a7b41a67778ee [tint] Add RW storage textureNumLayers overloads by James Price <jrprice@google.com>
  - f6644010956387feeb0b5f48e7574db274647d15 [tint] Add RW storage textureDimensions overloads by James Price <jrprice@google.com>
  - 807f3efd81268d562138b0915bbd36589979ecac [tint] Add RW storage textureStore overloads by James Price <jrprice@google.com>
  - d90c72b0cb60af62c43a800cb354c70d4090ba9b [tint] Add RW storage textureLoad overloads by James Price <jrprice@google.com>
  - 9daa5043cb362e455457c5dbe081ce60ed978e66 [tint][validator] Allow read_write storage textures by James Price <jrprice@google.com>
  - a2aecdaccbcfaee333ad502c03599408398b75c1 [tint] Add chromium_experimental_read_write_storage_texture by James Price <jrprice@google.com>
  - 926a6fffd664c445e3d039833e4e82e6ee2a348a [tint] Separate cmd tools into separate directories by Ben Clayton <bclayton@google.com>
  - ef88b0fa006c0036e6f9e581536cc5594b315b87 [tint] Move core intrinsic table data to new subdir by Ben Clayton <bclayton@google.com>
  - 0f8b6efb70a1cc1de5c66981cd48ad57c5b9c863 [tint] Use explicitly (small) sized enums by Ben Clayton <bclayton@google.com>
  - fa60c0f891803ad24ffc95cc992861da2b67942a Fix TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM debug function by Shrek Shao <shrekshao@google.com>
  - 6e01381298cd8eb6a1046fb20e326993be955d57 Disallow Multiple Render Targets When Using Dual Source B... by Brandon Jones <brandon1.jones@intel.com>
  - 7f369a3a9757d2e4aa6cb0e26bbad86665eeb83e [tint] Remove ir::BindingPoint by James Price <jrprice@google.com>
  - 43c8cdca066aea25fa0690d20a520939f4d6728d [tint] Remove sem/external_texture.h by James Price <jrprice@google.com>
  - cedcdf3cae4021e99fade12e7e538f29ed37c275 Change namespace of tint::type by dan sinclair <dsinclair@chromium.org>
  - 508ba637311325ff0200c867634746c365d700ac [tint] Index the const-eval-functions in the intrinsic ta... by Ben Clayton <bclayton@google.com>
  - eb2f95e37e4ea5244f38f2728fee5b0fe12fbb1c [tint] Rework the intrinsic table to use indices by Ben Clayton <bclayton@google.com>
  - 563e6e5b35a32f2e6053e5857a957370ab220d42 [tint] Finish decoupling of intrinsic table from WGSL by Ben Clayton <bclayton@google.com>
  - 730abb3cfce41deca6a53f3083e20338b231a142 [ir][msl] Update MSL to create a tint::Result. by dan sinclair <dsinclair@chromium.org>
  - 5c764b1d45ed7398e41cb7fa0024ab1ea514a757 [ir] Fix missing commas in constant disassembly by James Price <jrprice@google.com>
  - 464b3b8c96371a6cc1ade17f8e3124652659d3af Move constant into `core` namespace. by dan sinclair <dsinclair@chromium.org>
  - 629e6cc75e27b5261bab989d17dde3f66d546177 [ir] Fix condition in DemoteToHelper by James Price <jrprice@google.com>
  - 101fa27be803f1a5686efe0908434405c0283113 [ir] Fix MergeReturn for trailing returns by James Price <jrprice@google.com>
  - cef35b16b3150563ce59f1e98dded5a046293088 [tint] Add missing doxygen comments by Ben Clayton <bclayton@google.com>
  - 17fa668f79fae4a8235e91a58a9b6c18ba9781e8 [tint] Begin decoupling intrinsic table data from table.cc by Ben Clayton <bclayton@google.com>
  - 015fbe706cc4b865994106353aaf15e2b43fdfb7 [tint] Move ParameterUsage from sem to core by Ben Clayton <bclayton@google.com>
  - 807bd98a3f1ab689ef076475c489bf3b126c825c [gn][tint] Add libtint_builtins_src to libtint by Ben Clayton <bclayton@google.com>
  - 55faf99b314d17264940a0e5902e4a2f098a2c77 Fix syntax tree build. by dan sinclair <dsinclair@chromium.org>
  - 46ba431048abae3e52761c00f78b59f1b63bfd73 IWYU: add cstdint for uint32_t in tint by Stephan Hartmann <stha09@googlemail.com>
  - 7b78b8bf87674de287b503df9f7000f03ddbb279 [tint][cmd] Fix printing of wgsl errors by Ben Clayton <bclayton@google.com>
  - 1072da894dc7b07e6c48ef912a8265ad5ecea0a6 [tint][wgsl][printer] Fix heap use after free by Ben Clayton <bclayton@google.com>
  - 36c6155720b91009f8e0ddba51c817b6917708b2 [tint] Move EvaluationStage from wgsl/sem to core by Ben Clayton <bclayton@google.com>
  - fc6f03c2a0371e058bb82871b8f6f17c319adfd2 [tint] Move resolver/ctor_conv_intrinsic to core/intrinsic by Ben Clayton <bclayton@google.com>
  - c2299082fb2cc270972f54dfad2a4e2cdb038495 [tint] Move resolver/const_eval* to core/constant by Ben Clayton <bclayton@google.com>
  - 67b461baa328f033c2e287ac23df88d7ebd03d6d [tint] Promote ast::UnaryOp to core::UnaryOp by Ben Clayton <bclayton@google.com>
  - edc51abb2ab652f0bef72dcbe6c1becabb03367d [tint] Promote ast::BinaryOp to core::BinaryOp by Ben Clayton <bclayton@google.com>
  - fe24b4a991991173e9cb3b6bed0f4ceb922444ed [hlsl-writer] Add support for subgroup inputs by James Price <jrprice@google.com>
  - 501983f554cb168a3c164984655b251570bf7901 [hlsl-writer] Add support for subgroupBallot by James Price <jrprice@google.com>
  - e6162bd9614a2077e2aae3c6f863d9019266c283 [tint] Disassemble SPIR-V using SPV_ENV_VULKAN_1_1 by James Price <jrprice@google.com>
  - 47e3312658e36fde6dc8b931cf2ce104c3b46e97 [tint] Add validation for subgroup builtin inputs by James Price <jrprice@google.com>
  - f5104e057d633c54457cd6d5534b0ed497bc3884 [ir][spirv-writer] Bgra8UnormPolyfill transform by James Price <jrprice@google.com>
  - bf9311851b4baaa670e921e6a0a2f09eca3a75c9 [ir][spirv-writer] Polyfill textureSampleBaseClampToEdge by James Price <jrprice@google.com>
  - 5e347d0f656c16e93db555afb81ceb5a99b5b863 [ir][spirv-writer] Polyfill count*Zeros builtins by James Price <jrprice@google.com>
  - aec5309bb7a325f6b41a977a51e8b4f07d749b0c [ir][spirv-writer] Polyfill first*Bit builtins by James Price <jrprice@google.com>
  - 6a02b4ea869b887556170b3a97cfab2b7ab06d62 [ir] Fix renamed namespace by James Price <jrprice@google.com>
  - ad03ceb768e46636f3ea7fc9c62f481f54554191 [tint][wgsl][resolver] Add missing template arg check by Ben Clayton <bclayton@google.com>
  - e88a4bf8eeb9196c660fec2b6f31bc45697eb42e [ir][spirv-writer] Polyfill saturate builtin by James Price <jrprice@google.com>
  - 9b73ec2cc96e0b1f31df5bccac7a2df4f0ea33df Metal: Explicitly set MTLCompileOptions.fastMathEnabled by Corentin Wallez <cwallez@chromium.org>
  - cd52f38c06c3ab9084e4a05c2cff209c64531179 [tint] Move tint/lang/core/builtin to tint/lang/core by Ben Clayton <bclayton@google.com>
  - 18c3748d3aee372065a30ea10a46138ce8a9bb8c [tint] Move intrinsics table from lang/wgsl/resolver to c... by Ben Clayton <bclayton@google.com>
  (And 157 more changes)
GitOrigin-RevId: d42eb93712b5424d9d3144b78628b2d8487d95f4
Change-Id: I8520e15ce2f11832b8c677a21f031ba1e330a50c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/147940
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
3301 files changed
tree: 6eca535f3e7e7791738f936f91a75c972af2683f
  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.