EXPECT_THAT(xxx, Eq(yyy)) << ToString(xxx);
is a less-idiomatic way of writing:
EXPECT_EQ(xxx, yyy);
The latter also provides a diff when two strings do not match.
Refactor these to:
auto got = xxx;
auto expect = yyy;
EXPECT_EQ(got, expect);
So that the error message clearly shows which one is the generated, and which one is the reference.
Change-Id: I781437ee63abdff3a67798b09e958be603c21313
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35507
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Introduce `StatementBuilder`s , which may hold mutable state, before being converted into the immutable AST node on completion of the `BlockStatement`.
Bug: tint:396
Bug: tint:390
Change-Id: I0381c4ae7948be0de02bc13e54e0037a72baaf0c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35506
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
In SPIR-V, coordinates for ImageRead, ImageFetch, ImageWrite are
integral. When they are unsigned, they must be converted to signed.
Fix tests for image sampling and dref sampling that used integer
coordinates. SPIR-V requires them to be floating point.
Bug: tint:109
Fixed: tint:346
Change-Id: If33c8970b9d8f7d934d3e582194fe6ed83eff7e8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35560
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
This CL adds a Symbol to the struct type along side the name. The name
will be removed in a future CL when the symbol is used everywhere.
Change-Id: I6c355908651ba0a155a1e0c9ed1192313a405568
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35620
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Coverage can be useful for debugging unfamiliar code. If the bug causes a non-zero exit, then we still want the coverage to be generated.
Change-Id: I2d218cd4bb1395c71553e1baab78fb6ca9d41cca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35422
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
And swap the `decorations` and `members` parameters, as decorations come last for other constructors.
Parsers need fixing up.
Bug: tint:396
Bug: tint:390
Change-Id: Ie9b814c1de24b6c987f0fbb9e6f92da7c352caa2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35163
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
All nodes that don't have a Source constructor will need to have one added.
We can then find all missing Source mappings with a search for `Source{}`
Bug: tint:396
Bug: tint:390
Change-Id: I06f9689d4da0f3fd1bd757c7358dcc65f15dc752
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35018
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds a Symbol alongside the name in the Alias type. The name
will be removed in a future CL.
Change-Id: I23fa77566cc7a2aead783b64c34c0cc3195df24b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35461
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL adds a Symbol to the identifier to represent the name. The name
still exists but will be removed in a future CL when the namers are in
place.
Change-Id: Ic3cc8ad0d99e3bea6eb1ff1ce212e7de67991aec
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35460
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
- The create function is available locally without needing
to go through ast_module_.
But go through ast_module_ during member initialization.
- Add ToI32 helper.
- Use it during possible conversion of the sample index
Bug: tint:3
Change-Id: I8224119f780486d769697910dfa3dd9fb5413259
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35541
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL adds a simple demangler to convert the `tint_symbol_YYY` back to
the original symbol name.
Change-Id: I532ed13dc4c52e0f0e3568b8b7d8d0a5c67d8472
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35440
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This Cl adds a Symbol representing the function name to the function
AST. The symbol is added alongside the name for now. When all usages of
the function name are removed then the string version will be removed
from the constructor.
Change-Id: Ib2450e5fe531e988b25bb7d2937acc6af2187871
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35220
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Only ImageFetch is supported.
Converts the signedness of the sample operand as needed.
Bug: tint:109
Bug: dawn:399
Change-Id: I1d00ff4452af123457bb1841d872afcf2c591c48
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35540
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Remove all Variable setters (with exception to set_storage_class() which is called by the TypeDeterminer)
Bug: tint:390
Change-Id: I172667e21e2b02e85dcea6703aa1e608ec718250
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35015
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This Cl updates the various namer objects to work off the symbol table
instead of names.
Change-Id: I94b00a10225d0587f037cfaa6d9b42e2a8885734
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35101
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
So that it transforms more on clone than in-place.
Bug: dawn:548
Bug: tint:390
Change-Id: I0127bc02c4e0e88c924042c491d274363422cc52
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35420
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This CL adds a table which maps symbols to strings. This will allow us
to remove the use of std::string in the various AST nodes and refer to
the symbols instead.
Change-Id: I902641b3e546a2a44b3b2a39ce4f019cdcbeacc7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35100
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Support:
- SAbs
- UMax, SMax
- UMin, SMin
Add tests for operand and result conversion for UClamp.
SClamp was already tested.
Bug: tint:3
Change-Id: I9b9278843ca5243991b330b27764756137da4ee4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35302
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
The `libtint-fuzz` target needs to be defined before reference.
Change-Id: I030f4b3b93a095bd353aa6cff402e351d5b77dca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35381
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Despite the documentation claiming otherwise, the DXC doesn't allow
these to be anonymous.
Change-Id: I853d11970890106b8fd4d6b8bb321940f0658bd3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35281
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
If there are transforms added to the manager, then Run() would output an empty module. Fix this.
Bug: tint:390
Bug: tint:389
Change-Id: I439fe7a28816761f3702e304ef130b7a6992ecce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35280
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
SClamp is the only implemented instruction that is affected, so far
Bug: tint:405
Change-Id: I21c1cdd3e70fc3a64046f0473569ba906048cd37
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35240
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Change-Id: I29cee48b3b757373f90768af545a7449f60a5f26
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35142
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
All unsigned texture intrinsic parameters were recently changed to signed: https://github.com/gpuweb/gpuweb/pull/1271
Update the writer tests to match. The spirv reader side of things will also need to be updated.
Bug: tint:391
Change-Id: I280f223f2556355f4b6538ae1ef446e33b017c9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34820
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also map FClamp, FMin, FMax to WGSL "clamp", "min", and "max".
The behaviour of FClamp, FMin, and FMax doesn't specify
much when operands are NaN. Map to WGSL functions
which are more prescriptive about results when operands are NaN.
Also add TODOs for the GLSL.std.450 instructions that I had
missed earlier: the interpolate-at instructions
Fixed: tint:214
Change-Id: I10f7df66875ccda968fc5654b4f1c1d3a6ac23ca
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35062
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Also map FClamp, FMin, FMax to WGSL "clamp", "min", and "max".
The behaviour of FClamp, FMin, and FMax doesn't specify
much when operands are NaN. Map to WGSL functions
which are more prescriptive about results when operands are NaN.
Also add TODOs for the GLSL.std.450 instructions that I had
missed earlier: the interpolate-at instructions
Change-Id: I48503be68128d2a0659bef7057e890cb9c0617ad
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35080
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Auto-Submit: David Neto <dneto@google.com>