Use `static constexpr bool` instead of `std::integral_constant` for `IsTypeOrDerived`. This is often cleaner to use.
Add `IsCastable`, a helper for determining if all the template types derive from `CastableBase`.
Add `CastableCommonBase`, some template magic for determinine the most derived, common base type for all castable types.
Change-Id: Ia3d33548424750f8260f518ecd63d39949e4a826
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81105
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
The fix involves unifying the dependency logic of DependencyScanner, which also cleans up the code quite a bit.
Also:
* Correctly resolve parameter type before declaring the parameter variable.
* Fix bonkers typos in utils::Lookup.
Fixed: tint:1442
Change-Id: I77b548e148b461f87ec10e8272c398f6fee297bd
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81102
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This didn't make the M100 release branch, so update the release notes.
Fix a type in one of the E2E test names.
Bug: tint:1437
Change-Id: I36c018a126f412607a55ff254add60dae4fa9ae5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81200
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Breaking isn't always desirable, as there are many tests that intentionally trigger ICEs, which are caught by a EXPECT_DEATH().
On Linux the break also performs IO, which will likely cause problems in Chromium's sandboxed environment.
Change-Id: Ic2e1f5d13c9e986c066eaf364ffa5759c7299f6a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/81103
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
They have no effect in graphics APIs.
Fixes: tint:1440
Change-Id: I80a4b2f5875fbabbd53fd1ebd085ba146401ca71
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80980
Auto-Submit: David Neto <dneto@google.com>
Kokoro: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
If the line contains non-ascii characters, then we cannot assume that a single utf8 code unit represents a single glyph, so don't attempt to draw squiggles.
Bug: tint:1437
Change-Id: Ibd911200b03297f3e1b059ad7cc53fcba59e7714
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80846
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
BUG=tint:1432
Change-Id: Id1c8710821077341ad04d12c1c55211043c84ca7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80861
Reviewed-by: David Neto <dneto@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
WGSL was the only format that wasn't being validated for our E2E
tests, and this meant that WGSL backend bugs were sometimes going
unnoticed.
This change uses Tint's WGSL reader to validate the WGSL output.
Change-Id: I7d9e1c22feda530e7ba594725f21e576cf928647
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80961
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
The `mat` token is a reserved keyword in WGSL, so don't try to create
identifiers that using it.
Bug: tint:1438
Change-Id: If3840aff35ab0ea937df776cd95920dd55157d9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80960
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Implements a basic decoder for utf8 and codepoint tables for XID_Start and XID_Continue.
The first steps to supporting unicode identifiers.
Bug: tint:1437
Change-Id: I7371d1e63d664f3a3c34929221c7c6d043beb45d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80842
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Explicitly filters out problematic files from presubmit with issues
that are not under our control, i.e. URLs.
BUG=tint:1433
Change-Id: I34a449c825edc39f934cbe9afa3436f7514f2808
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80860
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
The fix is in the mix().
Bug: tint:1429
Change-Id: Id128ead6b124cd364f45a860ad991977be94be5b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80660
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Bug: tint:1427
Change-Id: Ide2b89ac5f61237d0d39c1210dadaf9587c5db97
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80360
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Stephen White <senorblanco@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Don't lose reference-ness of expression. This is necessary for
assignments via the hoisted variable, for example.
Bug: tint:1300
Change-Id: I8e633f20e50541bb70becc5069019f795ec11e01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This replaces the @override keyword that was previously used for
pipeline-overridable constants.
Support for pipeline-overridable constants in Dawn is hidden behind
the "disallow-unsafe-APIs" toggle, so we can make this change directly
instead of deprecating and continuing to support the old syntax.
Fixed: tint:1403
Change-Id: I9b2957a1e33b12772bfe449c0f3a31d929f8aa8b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80480
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Change-Id: Ifef0b3bb449de2bffc5bc3b84886d4f678971620
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80521
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
(I know it's deprecated, I'm just being a completist.)
Bug: tint:1222
Change-Id: Ie7716d2f5dd2d2bd2245ba2b0fe7ed8705574de0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80141
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
These still had vestiges of HLSL.
Bug: tint:1222
Change-Id: I5f93f75e7384db641f0c5421dca24a3e8f2b716e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
For the tint_all_transforms_fuzzer. Exercises the fact we now allow
declarations in any order.
Bug: tint:1266
Change-Id: I9ddfac90aaafe213cd860944f210718216cb3d13
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79770
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Allow module-scope declarations to be made in any order.
Bug: tint:1266
Change-Id: Ib2607b6c33fad7c83e2c36f85b0a965eac922ec5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79769
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Change-Id: Ib61ff92d373b63c39bbf664a2c67d5f0b8e9bd2e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80080
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
That is, bring back both VarForDynamicIndex and
PromoteInitializersToConstVar. This is not a complete revert, though:
* VarForDynamicIndex no longer depends on ForLoopToLoop
* Both can cope with hoisting from "else if"
* More unit tests were added in the interim
Delete PromoteSideEffectsToDecl for now. This may be brought back to
handle ensuring order of evaluation.
Bug: tint:1300
Change-Id: I8bbae46377ec4603cc02c1eb3f0661a8461a19fa
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79940
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This is an ongoing LUCI config format migration.
R=jrprice@google.com
Change-Id: I12c2913b61f97ea1a4108ac9e5cc0b46f0be3765
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79960
Auto-Submit: Vadim Shtayura <vadimsh@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison (use @chromium.org) <rharrison@google.com>
Commit-Queue: Ryan Harrison (use @chromium.org) <rharrison@google.com>
This significantly simplifies the calling code from Dawn.
It does require moving the SingleEntryPoint transform above the
renamer, since we need to call SEP with the original name. That is
probably also an optimization, since we do the subsequent transforms
with a culled AST.
Bug: tint:1268
Change-Id: I1f48ec0238ea76310742c60b119311747dd3dbac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80020
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
MultiplanarExternalTexture cannot deal with out-of-order declarations.
Re-work things so that it can.
Bug: tint:1266
Change-Id: Ie2c8237be4f6ddb91120cbeb25f3c186b572ba59
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79768
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
As the resolver currently enforces in-order declarations, this does not
change the declaration order from iterating over the
ast::Module::GlobalDeclarations.
The MSL backend has been changed to use the
sem::Module::DependencyOrderedDeclarations list instead of looping over
different declaration types separately.
Bug: tint:1266
Change-Id: I698d612032285311017bfceab3c42adae1928a0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79767
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Holds `DependencyOrderedDeclarations()`, which will hold the
sorted dependency-graph ordered list of global declarations.
Bug: tint:1266
Change-Id: I9840fae8689abd214973ea4785f71c3ae2587bbc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79766
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
If you attempted to:
* Use a function as a type
* Use a variable as a type
* Use a variable as a call target
You would get an ICE. Replace these with proper error diagnostics.
Change-Id: Ibbe4cd1b59b1aadd451aa0445ad137859aa071eb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79765
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This toggle controls if the fuzzer will throw a fatal error in the
case that the shader becomes invalid.
Currently the fuzzers do no guarantee that the options that are
provided are correct/valid, so there are many uninteresting cases that
become invalid due to the limited nature of the fuzzers, not due to
bugs in the code. The default off state of this toggle will suppress
this noise.
Once https://bugs.chromium.org/p/tint/issues/detail?id=1356 is
implemented this toggle can be default on.
BUG=tint:1357,chromium:1294533
Change-Id: I7170e5a30691105c97e20d8337aadf81ac2bc3bc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79840
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Will be used to implement order of execution.
Bug: tint:1300
Change-Id: I027295e482da7a3f9d7ca930b5303e8f89d7fe09
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79824
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Introduce a glsl::Version, to allow the client to specify ES or
Desktop, as well as the desired GLSL major and minor version.
Bug: tint:1422
Change-Id: I4116bc2da40ae6a553dc2522d042dda1464a0c05
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79700
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This is a check that has been added to newer versions of clang and is
tripping for me locally. The actual issue is in code being generated
by protobuf.
Updating protobufs has cross-dependency issues with spriv-tools, so is
non-trivial. There is already a special case suppression for internal
protobuf issues, so I am just adding to the carve out.
BUG=tint:1419
Change-Id: I3ecd111a778fb4c65a113382ded8d6160deab462
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79841
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Declare the list of transforms once, and use this for the usage message and when a transform does not match.
Simplifies adding new transforms to the command line tool.
Change-Id: I57ec433d8a570dae465d1837f5a4c1d89b8cff05
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79280
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also make tests more idiomatic by removing diamonds in the Node
hierarchy.
Bug: tint:1300
Change-Id: I681f4251bd8d9bdef169dcdf5de345792c927436
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79680
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Other shader types don't need this.
Also fix code style of member var.
Bug: tint:1360
Change-Id: Ic3600ec7c6da9b85b57655fabbf1f2e44b0ea7d3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79640
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
We'll need this to build the GLSL backend in Dawn, since we don't want
glslang there.
Bug: tint:1217
Change-Id: Ied44ca89286c1d53a2e58a7083f0bfb859976770
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79500
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Currently contains a subset of ast nodes to make it easier to debug.
Bug: tint:1331
Change-Id: I27afe3c57aa752bdf823120e31585100c8adbe36
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79460
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>