Import Tint changes from Dawn

Changes:
  - cc636969b7b7bb04043ca15673c82dc94e7fdc17 [tint][wgsl] Replace size_t with uint32_t for IDs, Source. by Ben Clayton <bclayton@google.com>
  - 144ebed4c7ee7c6ecddeedfa81d607bbf256e8f2 tint/hlsl: widen scope of workaround of DXC bug with cons... by Antonio Maiorano <amaiorano@google.com>
  - 0880e0643379ff2535187662cb21a803ce974cfa Rename @index -> @blend_src by Corentin Wallez <cwallez@chromium.org>
  - dfb4eb05d2a4e65e22fbb3b0441e74f136fa9190 Add @blend_src as an alias for @index. by Corentin Wallez <cwallez@chromium.org>
  - 31a1592736e3465599145aa6f9ea9333bfd05196 [tint][sem] Replace more uses of std::vector with tint::V... by Ben Clayton <bclayton@google.com>
  - 8be957f698baa57c87eca49aa5f93315081172a3 [tint] Replace std containers with Tint's containers in n... by Ben Clayton <bclayton@google.com>
  - 5ff42f8900bae798cfc57d45953d387a994089a9 [tint][core] Don't create throw-away StructMembers by Ben Clayton <bclayton@google.com>
  - f9ffc45753f3eb668c058b0b8e62a77a0a3cb331 [tint][resolver] Don't create throwaway sem::Parameters by Ben Clayton <bclayton@google.com>
  - 10f1b6bdb4a7bd8e316d389230471654290cda66 [tint][utils] Fix Hashmap's small vector size by Ben Clayton <bclayton@google.com>
  - 80144d262ecef9331783faaa8ca4dfa6dfcfd60c [tint][hlsl] Fix names of vector / matrix setter utils by Ben Clayton <bclayton@google.com>
  - 652353953be36fd60ffc26788e7b5f3833a41dc4 [tint] Move unrestricted_pointer_paramters to kShippedWit... by Ben Clayton <bclayton@google.com>
  - 4eeb0bd6e2dc3f608a079b7e62ff3fd3befccdef Implement push_constant-based firstIndex transform. by Stephen White <senorblanco@chromium.org>
  - c65ac40803c289104fa26156113ebfd37280dd7a [tint][wgsl] Consider builtin calls as part of ptr analysis by Ben Clayton <bclayton@google.com>
  - 868380669fb051756b154d531beb805a990a6674 Move ClampFragDepth transform to WGSL transforms. by Stephen White <senorblanco@chromium.org>
  - c6ed507397f87c5ee96b01d2eed3eb77a0899c25 [tint][wgsl] Use tint's containers for ptr analysis by Ben Clayton <bclayton@google.com>
  - 02262d895ff373badfc4d2233f8e14108d185687 [tint][msl] Fix C++17 warning. by Ben Clayton <bclayton@google.com>
  - a840d5132ac88153efb26c92a24178d7d68eddef Replace CMAKE_SOURCE_DIR with PROJECT_SOURCE_DIR by amirsojoodi <amir@distributive.network>
  - 15d2710c84b3420bd20da25b8ccbe5681521df84 Remove data returned from `TextureBuiltinFromUniform` tra... by dan sinclair <dsinclair@chromium.org>
GitOrigin-RevId: cc636969b7b7bb04043ca15673c82dc94e7fdc17
Change-Id: I949ec6ab831105ee01a2b5e92e96db023a9a469e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/171360
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
120 files changed
tree: d68b9bbdf9146a9add7649eda0d84d64ca16f974
  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.