Import Tint changes from Dawn

Changes:
  - 262a4c482473dea0d0b0263410f98af812f169aa tint: More doxygen fixes by Ben Clayton <bclayton@google.com>
  - 05caf3a20f18ada629ce818d92b0022bef41541d tint: Fix doxygen errors by Ben Clayton <bclayton@google.com>
  - 7eaab385749870704ff3ae7f831740cb5b0c3194 tint: Simplify backend Sanitize functions by passing in O... by Antonio Maiorano <amaiorano@google.com>
  - a7230f06ff67d804f5d6cefad175cabc1f066e57 tint: Standardize the way we forward-declare by Ben Clayton <bclayton@google.com>
  - 30353998c142badf50c38d1bd538c13a5a8d35c5 tint: Fix copy instead of move of ArrayLengthFromUniform:... by Antonio Maiorano <amaiorano@google.com>
  - 81e497c45f5fe67ca43f9ed3567f7ac958df1800 tint: handle CRLF on Windows when splitting WGSL source by Antonio Maiorano <amaiorano@google.com>
  - 4d36557bcea70269f3492a5e65367e59e6ee2b1c Normalize all line endings to LF by Ben Clayton <bclayton@google.com>
  - 9d27aaaaa1e2d5bc7ee596eb11ab91db7af51aa3 Always use 0 for the Depth operand of OpTypeImage by Jiawei Shao <jiawei.shao@intel.com>
  - 9e9db88e329efbd8de0a93c0f73d7a53ec10b9e7 Minor formatting changes. by dan sinclair <dsinclair@chromium.org>
  - 8155b9dada070a01b8a2f97b6e07782beaa7a1fc Condense namespaces in tint/. by dan sinclair <dsinclair@chromium.org>
  - 612a59be41404006d0c444841edd7314ccd602f4 Condense namespaces in tint/reader. by dan sinclair <dsinclair@chromium.org>
  - 258cbafdec5f6ee0acf3772e573029bba73b0601 Condense namespaces in tint/reader/spirv. by dan sinclair <dsinclair@chromium.org>
  - 34323ac069928e9afd88e5b2d1e98461a7dc19a7 Condense namespaces in tint/ast. by dan sinclair <dsinclair@chromium.org>
  - aba5a212ca73c71673f6e2d32226402bdcabb646 Condense namespaces in tint/inspector. by dan sinclair <dsinclair@chromium.org>
  - ebfbaf8f22a6113bdc62c54114b94d6ad2a4cf67 Add top-level OWNERS and scope Tint owners more tightly. by Corentin Wallez <cwallez@chromium.org>
  - 30a03d9eedb603c1244c4292d786fa3cdb259d69 Condense namespaces in tint/reader/wgsl. by dan sinclair <dsinclair@chromium.org>
  - 62a1d7104f4e46e9010818e8d4f3769b063016f1 Condense namespaces in tint/fuzzers. by dan sinclair <dsinclair@chromium.org>
  - d209379cd1cb9e567b4faf0dfc2d2f8db2fad60b Condense namespaces in tint/resolver. by dan sinclair <dsinclair@chromium.org>
  - 7bc9ba13bdc1f5c1aa2e889113af8ac71abae786 Condense namespaces in tint/diagnostic. by dan sinclair <dsinclair@chromium.org>
  - fe4bfd45fe46024f87ab372fc85dcab36cc1068c Condense namespaces in tint/utils. by dan sinclair <dsinclair@chromium.org>
  - b5599d35f96f4b6d5ab57ed2d2791ed7b9d7e971 Condense namespaces in tint/transform. by dan sinclair <dsinclair@chromium.org>
  - bb19d4a24b8326d278f61e68c6a09a3411e7cdde spirv: Remove AssembleFailure() tests by Antonio Maiorano <amaiorano@google.com>
  - c990b3c867fffc203d16aab4315a3a40d5cd246d Condense namespaces in tint/sem. by dan sinclair <dsinclair@chromium.org>
  - 67e79fe506fd873b28a0008b142608e7015329c6 Condense namespaces in tint/writer. by dan sinclair <dsinclair@chromium.org>
  - c05f045df48a7a82063b9c4eaa19b91fa92468aa Condense namespaces in tint/val by dan sinclair <dsinclair@chromium.org>
  - 5d590591ef2290864b79aa0c4ba9fa10a0d42641 Condense namespaces in tint/writer/glsl. by dan sinclair <dsinclair@chromium.org>
  - 6a5bef19121f16345c57f8eee293992ae372b841 Condense namespaces in tint/writer/hlsl. by dan sinclair <dsinclair@chromium.org>
  - 411d065e2e56bf53eb16ffa2f46a8b31a54a2292 Condense namespaces in tint/writer/spirv. by dan sinclair <dsinclair@chromium.org>
  - 9fe8260dbb9833dcb44663b1a5fb6002f78f3598 Condense namespaces in tint/writer/msl. by dan sinclair <dsinclair@chromium.org>
  - d68d3a9809c1bcaecb89db1400fba66540abbdb5 Add support for increment/decrement statements by James Price <jrprice@google.com>
  - b02fe31e469d4cc2dcc504cda023c54f23557db1 wgsl: Add support for increment/decrement statements by James Price <jrprice@google.com>
  - 2f9e31cefb5b7b8cdec5dc60a7bed59ac40ee348 resolver: Validate increment/decrement statements by James Price <jrprice@google.com>
  - ebe9741d0c0df1e31c21c8cb79b870510a3ee844 ast: Add an IncrementDecrementStatement node by James Price <jrprice@google.com>
  - b28d6c8e1c5288d9a4ec2e0a910a66c435b532b1 Remove lintcpp from presubmits since it fails on all Dawn... by Corentin Wallez <cwallez@chromium.org>
  - 9f54a51b3d0f86cdb1516183a57d4d985efa4fe9 Condense namespaces in tint/writer/wgsl. by dan sinclair <dsinclair@chromium.org>
  - e72e42d9e0c851311512ca6da4d7b59f0bcc60d9 Add Tint's .clang-format file to src/tint by James Price <jrprice@google.com>
GitOrigin-RevId: 262a4c482473dea0d0b0263410f98af812f169aa
Change-Id: I91a1c735b94529f190ae4c34b40c486457dcfc0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/86305
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
1017 files changed
tree: c2f449d044894a81e31baec0cd233686b8c2a28b
  1. .vscode/
  2. build_overrides/
  3. docs/
  4. include/
  5. infra/
  6. kokoro/
  7. src/
  8. test/
  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
  27. tint_overrides_with_defaults.gni
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.