Import Tint changes from Dawn

Contains a manual fix for GN builds (adding 'tint_build_tintd' definition)

Changes: - 27f0080bbe19e7be70257d6cd4dcc3867e5781b6 [tintd] Implement lsp::TextDocumentSignatureHelpRequest by Ben Clayton <bclayton@google.com>
  - 2f215d1b7844f59c05a2dbb270815f5055da9c18 [tintd] Simplify installation by Ben Clayton <bclayton@google.com>
  - 369d8cdfc497c0ed2f47662c273ea1cd38844893 [tintd] Implement lsp::TextDocumentInlayHintRequest by Ben Clayton <bclayton@google.com>
  - 43dabe99b4d6c4bd4ccbfc1a4495a68f2135ea57 [tintd] Implement lsp::TextDocumentSemanticTokensFullRequ... by Ben Clayton <bclayton@google.com>
  - ef02c4cb844521cef32af3d5a03cd7b94774d30a [tintd] Implement lsp::TextDocument[Prepare]RenameRequest by Ben Clayton <bclayton@google.com>
  - aace4808de8332fbd96e23ada9feb28cff7a3108 [tintd] Stub required notifications by Ben Clayton <bclayton@google.com>
  - 82ac0fd8baab81192ed83c0db3d907e72c12f528 Mark dp4a methods as `@const` in core.def. by dan sinclair <dsinclair@chromium.org>
  - 06821eba8a7bdca9240c599ea9de376736cb2fa5 Re-enable disabled test. by dan sinclair <dsinclair@chromium.org>
  - 1617031fad9a06afeb5ec261bac8e50d9ce78619 Change emitted name for `StageAttribute`. by dan sinclair <dsinclair@chromium.org>
  - f3b93c1b2da8c55aacb49cb0763e6fcf666a8ff1 Add FoldConstants transform by dan sinclair <dsinclair@chromium.org>
  - 2366f480a965d3faa74c655d32781665b719a606 [tintd] Implement lsp::TextDocumentHoverRequest by Ben Clayton <bclayton@google.com>
  - 841ca1a590932d341e21ba46b7ecb21e3b60e841 Fix clang-tidy misc-include-cleaner complaints by David Neto <dneto@google.com>
  - c00db02cbbfedcc03ce23a2f237468d1405a5cda [tint][ir] Skip unreachable continuing blocks by James Price <jrprice@google.com>
  - 4176d450acf1e163378e2ca40325b82479c4dcdf [ir] Emit unreachable for loop body exits by James Price <jrprice@google.com>
  - 02a5e844e0baf819b6c28063d5fdb77831794ef9 [spirv] Fix unreachable handling in MergeReturn by James Price <jrprice@google.com>
  - c69f7695fc76ad93f44dc5c8653af1e365bf4559 [tintd] Implement TextDocumentReferencesRequest by Ben Clayton <bclayton@google.com>
  - ee9f1f67b860f424787ff174363f627aa2ebf41f [tintd] Implement TextDocumentDefinitionRequest by Ben Clayton <bclayton@google.com>
  - 7b1819b647abd1dd097fa62db85ed023998793ea [tintd] Implement TextDocumentDocumentSymbolRequest by Ben Clayton <bclayton@google.com>
  - 3f05fea94ec7aa785921b4b095f610bcbca20588 [tintd] Implement basic document handling. by Ben Clayton <bclayton@google.com>
  - b827111c8e489e61b0971232b0da133ca63a7e44 [tint] Preserve derivatives in DemoteToHelper by James Price <jrprice@google.com>
  - 29b75b83730ce94abbb603f7dd4c0afbadf21192 Revert "Use abseil's build targets instead of custom ones." by Geoff Lang <geofflang@google.com>
  - 8a8c582e290b89d92e129ec31b9b69794a91285d [tintd] Add package-lock.json by Ben Clayton <bclayton@google.com>
  - e770313425483dc500296624f6889e9a20ee8cbf tint_cmd: Flush stderr after emitting non-error diagnostics by Antonio Maiorano <amaiorano@google.com>
  - 11dc848eca01299dbc124f3e41ee8166e7e2c340 [tint][wgsl] Expand module-scope declaration sources to c... by Ben Clayton <bclayton@google.com>
  - 89c05af961c8118aa2b8bacf950f9ced8223b2f7 [tint][core] Move core::intrinsic::Match() from .cc to Co... by Ben Clayton <bclayton@google.com>
  - 0e3657146c65ae3275703e92a087350cc81da33c [tint][wgsl] Stub 'ls' the language server package for WG... by Ben Clayton <bclayton@google.com>
  - 0a7731b7d7855b01b929f7fe364f9c208b225ab5 tint/win: fix TmpFilePath asserting in some msvc crts by Antonio Maiorano <amaiorano@google.com>
  - 65afc844c0176313c8f97c87d3c20b6671aa73ba [tint][utils] Fixes for TerminalIsDark() by Ben Clayton <bclayton@google.com>
  - f9a5b712d89d18e969d08e1f7b90fd0c6197b56b [tint] Add DEPS & build support for jsoncpp, langsvr by Ben Clayton <bclayton@google.com>
  - ad08453d7254b0859b5524b0b5475730755ceb2a [tint][ast] Fix std140 matrix size by Ben Clayton <bclayton@google.com>
  - 2ce42fc95ab7cf7bbf97a9c48876c67c95f9cb78 Use abseil's build targets instead of custom ones. by Geoff Lang <geofflang@google.com>
GitOrigin-RevId: 27f0080bbe19e7be70257d6cd4dcc3867e5781b6
Change-Id: I84800f0b65ba70f93422cce1bfea062070278f56
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/180487
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
95 files changed
tree: d7ec9502b2952a991d27c99478865610275a22bd
  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. LICENSE
  22. OWNERS
  23. PRESUBMIT.py
  24. README.md
  25. 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.