Import Tint changes from Dawn

Changes:
  - 34eee4e680119d3e3c8950bf8c81423813bd550d [hlsl] Invert 'w' component of fragment position by James Price <jrprice@google.com>
  - 85b77e002384a06fa182fb672ce98f0e942a5b59 Tint: implement the polyfill of pack4x{U|I}8 with dot pro... by Jiawei Shao <jiawei.shao@intel.com>
  - 692b15ba4e194a2f030022989db335814e43ebc8 [tint] Fix nested texture-sampler pair collection by James Price <jrprice@google.com>
  - 47ae7fc989645406705ec765a17f686e93e58226 [glsl] Match parameter order in CombineSamplers by James Price <jrprice@google.com>
  - c8ca47fb936a40af08c055e28453dd58a2a8e5b3 Implement pack4xI8 and pack4xU8 by Jiawei Shao <jiawei.shao@intel.com>
  - fa12b64a994c2db2cd5f8ff05a179c93e727c17b [spirv-reader] Emit module-scope private variables by James Price <jrprice@google.com>
  - 6fcd2dbf85165d68c4f2b176b60ddc51bb1ca1c5 [spirv-reader] Handle OpConstantNull by James Price <jrprice@google.com>
  - 44fd934e2adc874bc95db04957e7a088d5c41c99 [spirv-reader] Emit function-scope variables by James Price <jrprice@google.com>
  - 09b618cf4ec14b9248f4eff7dcb91d05d9eac964 [spirv-reader] Handle vertex shader declarations by James Price <jrprice@google.com>
  - 507a650b8a55743a495f4bff335857ee0192246d [spirv-reader] Handle fragment shader declarations by James Price <jrprice@google.com>
  - ceb2cd5e21d46fe7cfb7dcb97f25051289969c5e [spirv-reader] Handle float types and constants by James Price <jrprice@google.com>
  - 3699f6541792b174cd9e0e8a69f14684d12b382a [spirv-reader] Handle integer types and constants by James Price <jrprice@google.com>
  - 2d70c1d55f54f209c25e8a6aed3cf55eb9d255ad [spirv-reader] Implement OpReturnValue by James Price <jrprice@google.com>
  - 884af6b070cbee6e32731ad6bf3746b30231aa32 [spirv-reader] Emit function parameters by James Price <jrprice@google.com>
  - 9c54476ce64f21d6878ede05af9397dd55973a14 [ir] Fix cloning of variable initializers by James Price <jrprice@google.com>
  - 3bb3c53010c7c655a24501d1b8dd76aee33da85f Canonicalize index-ordering of entry point attributes by David Neto <dneto@google.com>
  - 0044a0e04d2b4627d2c20c7986525eb4f29ca895 Generate texture builtin cases in a fixed order by David Neto <dneto@google.com>
  - ae7600a10992bb52603c66f1760778fcb0650864 [tint][ir] Serialize StorageTexture types by Ben Clayton <bclayton@google.com>
  - 60c67169d7d3278f85a91fdba3abce6f16f468ac [msl] Fix default interpolation sampling by James Price <jrprice@google.com>
  - 615eeaaaba9ba8b21de204f31d37e8ff075c78f5 [tint][ir] Serialize SampledTexture types and fn return l... by Ben Clayton <bclayton@google.com>
  - 66926dc3ebe9343f69a74263373f794933a565f5 [spirv-reader] Emit basic function calls by James Price <jrprice@google.com>
  - 230cd69cba7595b55399ab7b06fac2b520678b0e [spirv-reader] Handle entry point declarations for GLComp... by James Price <jrprice@google.com>
  - 8eae7c09ab83155ed3114dc1cfaba5b939517b7b [spirv-reader] Start emitting functions by James Price <jrprice@google.com>
  - d0dadce62bd0c397373fab0fa5e2dead57b580c6 [spirv-reader] Add PIMPL parser sources by James Price <jrprice@google.com>
GitOrigin-RevId: 34eee4e680119d3e3c8950bf8c81423813bd550d
Change-Id: Id410cc6bce78aff8bdd1c045afdac7fe92c1aa63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/165820
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
71 files changed
tree: 18928f04572f45d2b8d88106f0d48ea203f6c3b0
  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.