This is what its called in the spec.
Issue: tint:1361
Change-Id: I512c4224191fd2bbf04522da2093872f79ee02a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75581
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
All failures are now SKIP'ed.
Bug: tint:1358
Change-Id: If04d57b9e0b71dd877468b5dc277fbff82f36692
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
These were removed in https://github.com/gpuweb/gpuweb/pull/2474.
`read`, `write` and `read_write` were already excluded as keywords.
Fixed: tint:1359
Change-Id: I5424f780f4bd67bb336320a22dd2097ed03b4bd6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
The tool was getting slow, due to the number of branches being examined.
M96 is the latest stable release. We aren't applying fixes to this or older branches.
Also avoids an issue where the M95 branch was missing a cherry-pick, which the tool wanted to merge with each run.
Change-Id: I8a8b1466c10633d9539725cd4f9b1b0514e41e93
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75067
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Store the last search id suffix so that we don't research the same suffixes over and over again.
Bug: oss-fuzz:38098
Bug: oss-fuzz:38606
Bug: oss-fuzz:39300
Bug: oss-fuzz:40339
Change-Id: I295147d91bb9f805170c49114267033bbb781e4d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75427
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Constructing a null vector, matrix or array does not need to provide an explicit list of null elements. `T()` is a more efficient and readable equivalent.
Fuzzers like to generate enormous pathological composite types, which has been triggering OOM failures.
Bug: oss-fuzz:38095
Bug: oss-fuzz:39235
Bug: oss-fuzz:39246
Bug: oss-fuzz:39874
Change-Id: I910bb04bdd0e80532c09fc038be895ec37d3d380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75426
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
nullptrs are caused by errors. Detect and return before passing nullptrs to places they shouldn't go.
Also: Rename 'params' to 'args'. These are arguments, not parameters.
Bug: oss-fuzz:38074
Fixed: tint:1355
Change-Id: I77f97b4a8e5dab21802b300ba3eedad767ac2ad5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75425
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Also, issue an error when a gather or dref-gather operation
is used with a Bias or Grad image operand.
Fixed: tint:1336
Change-Id: Ife11d2f52a1a2d1b75e26269373db5cc4b3440bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74801
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
When the emit_continuing lambda always returns true, clang is able to
detect it and finds that some code is unreachable.
This commit changes places that use the lambdas directly to instead use
the stored emit_continuing_ member.
Bud: dawn:824
Change-Id: Idfd804a6ec53ac793e8988dce79991c659fbbc36
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75060
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Just like for divide, FXC fails with the exact same error when
performing a modulo on a value that FXC determines to be zero. We
address it in the same way as we do for divide.
This also fixes a couple of the vk-gl-cts tests for which I manually
generated expectation files for.
Bug: tint:1083
Change-Id: Ia388bf002112afded542adb791d37e88e35a77ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74220
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Also ensure correct paramter ordering: bias is always after offset.
Bug: tint:1351
Change-Id: I41ee66b86cd9d912f3857e5377b660c50d035c6e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73720
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
FXC fails to compile when it determines that the rhs of an integral
division is zero with "error X4010: Unsigned integer divide by zero".
bclayton's fix (https://dawn-review.googlesource.com/c/tint/+/60500)
addressed cases for division by an integer constant 0. This CL adds the
missing support for division by integral vectors with 0 components.
FXC also fails on division by integral expressions that it can fold to
0. To handle these cases, we now emit a runtime check for 0 and replace
by 1. In the cases I've tested, FXC seems able to optimize these checks
away.
Bug: tint:1083
Change-Id: I02f08e9077882f03c1e42b62dacb742a48fa48ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Change-Id: I32aaefe71ea728ae5118de08e5dd9073ddf2269e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73740
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Add two more warnings to ignore. These show up when including glslang
headers in samples/main.cc.
Change-Id: Icdb9fa9914bfe6fdafb4727ed8bf774fe9b930bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73660
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
There are a few places where a branch or return is created,
conditionally on whether a terminator was the last thing seen.
The goal is to generate a SPIR-V basic block terminator exactly
when needed, and to avoid generating a branch or return immediately
after a prior terminator.
Previously, the decision was based on the last thing seen in the AST.
But we should instead check the emitted SPIR-V instead.
This fixes cases such as a break or return inside an else-if.
That's because an if/elseif is actually a selection inside a selection.
Looking at the AST only works when trying to terminate the *inside*
selection. In the outer recursive call, the last AST node is
no longer a terminator, and we would skip generating the branch
to the merge block.
Fixed: tint:1315
Change-Id: I6b886ce85d1d681f2063997e469e0c1b4e5973a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73480
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
This picks up validation to ensure a struct of builtins on
the input or output interface is also decorated with Block.
See https://github.com/KhronosGroup/SPIRV-Tools/pull/4665
Fix SPIR-V in end2end tests that was breaking the rule.
Change-Id: Ic0e9c8936eb6b3f086b084d86b649e9e237fc3b3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73242
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: David Neto <dneto@google.com>
SPIR-V validation fails when an object has multiple ArrayStride
decorations. Remove the SPIR-V reader tests that did this.
Change-Id: Iaac0f0f0c9230ccbc7dde5414d6aaf6f0e972534
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/73240
Auto-Submit: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
* Rename GenerateNonReferenceExpression to
GenerateExpressionWithLoadIfNeeded.
This version takes an ast::Expression
* Add a variant that takes a sem::Expression, because the sem
expression already knows the resolved type, and so we can save
a lookup.
* Replace most uses of GenerateExpression ... GenerateLoadIfNeeded
with a call to one of the above.
This is a non-functional change.
Followup to the fix in tint:1343.
Bug: tint:1343
Change-Id: If19a1bc7670edd2badc1533861d8b42f0825c7b8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72720
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: David Neto <dneto@google.com>
A one letter typo would lead to invalid memory access in the very
specific case of outputting the layout for a struct within a struct with
field alignment padding, and the inner struct has more members than the
outer.
Bug: tint:1344
Bug: oss-fuzz:72642
Change-Id: I749e3fb172e78a20ece68b40be1a0a57dc5746f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72642
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
* Fixed DXC installation so that we download the latest release, and
patch it with the latest artifact build. This ensures that the correct
dxil.dll is next to dxc.exe, rather than having dxc.exe pick up whatever
dxil.dll is in PATH.
* To run tests with FXC requires the correct d3dcompiler_47.dll. To do
this, I modified the script to download the Windows SDK, and install
only the feature that contains the DLL.
* To avoid issues with DXC and FXC finding exes/dlls in PATH, modified
the script to temporarily set PATH as needed.
Bug: tint:940
Change-Id: Ic83b0b97f72ccc1f37b4b495eae6a6ab3421a95a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72560
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Saves about 5 minutes per Windows build.
Bug: tint:940
Change-Id: Ib03fb6ca9d51575d8ee82324be7040153e5536bf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72540
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Vulkan allows them, but WGSL does not.
A duplicate decoration is purely redundant.
A parameterized decoratio with different parameterization is
an inconsistency and a semantic error, at least for currently defined
SPIR-V decorations.
So for each target, only take the first decoration of each kind.
Fixed: tint:1337
Change-Id: I6ed5c39cf2e213c695cb8217ed1b97814da3db56
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72500
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
FXC fails to compile code that assigns to dynamically-indexed fixed-size
arrays in structs on internal shader variables with:
error X3500: array reference cannot be used as an l-value; not natively
addressable
This CL detects this case, and transforms such assignments into copying
out the array to a local variable, assigning to that local, and then
copying the array back.
Also manually regenerate SKIPs for HLSL/FXC after this change, which
fixes 30 tests. Also exposes some "compilation aborted unexpectedly" now
that "array reference cannot be used as an l-value" has been fixed. For
tests that fail for both DXC and FXC, updating SKIPs to the DXC one to
help distinguish actual FXC bugs from valid errors.
Bug: tint:998
Bug: tint:1206
Change-Id: I09204d8d81ab27d1c257538ad702414ccc386543
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71620
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
These missed the M98 boat.
Change-Id: Ic15e8323457d78eea1ea3c59c104b2901c883b1b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72321
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
These are errors:
let a = 0x;
let b = -0x;
Fixes: tint:1338
Change-Id: I9d26ad66e32deb954550c0ecfbda0a9005bcd380
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72380
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
The GLSL emitted for these was invalid, and we don't need these
structs since they're only used as the store types of buffers, which
are handled elsewhere.
Change-Id: I17c15e408b5c36e9b895e5950528a6d02d1802a6
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72381
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This attribute is now deprecated, and the warning is causing these
tests to fail.
Bug: tint:1324
Change-Id: I0665c9f3b657c8cb56e2252a23eb6184ea876075
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72420
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This has been deprecated and will soon be removed.
Bug: tint:1324
Change-Id: If5dbbc3a40d7591591fb2802dbe9c8dd5f96d299
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72087
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
These are no longer necessary and will soon be deprecated and removed.
Bug: tint:1324
Change-Id: I3fa076e7ce5eb36466d24c80fd1c83658c28c5ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72086
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
These are no longer necessary, and the attribute will soon be
deprecated and removed.
Bug: tint:1324
Change-Id: Ia3cdd4e9d9bd7bca45d734a06466993199b3e838
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72085
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
No code should rely on the presence of the block attribute, which will
soon be deprecated and removed.
Bug: tint:1324
Change-Id: I868d5e795e66a93bdf99b94389c07dec98cb0ec2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72084
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Skipping those that are block-decorated is not correct, as
block-decorated structures can also have non-buffer usages. This is
even clearer now that WGSL has removed the block attribute.
Bug: tint:1324
Change-Id: I6484766a5c541d39e2dc08beb3ae7b889759a3fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72083
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Any struct which is used as the store type of a buffer variable needs
to have a block decoration. If that struct is nested inside an array
or another struct, we wrap it inside another struct first.
This removes the SPIR-V backend's reliance on the [[block]] attribute,
which will soon be deprecated and removed.
Bug: tint:1324
Change-Id: Ib6ad54f24a3e4a090da9faeed699f266abcb66ba
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72082
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Replace all validation rules that rely on the block attribute with the
new rules based on fixed-footprint types.
Bug: tint:1324
Change-Id: I02656537bee66e6e1af95875e503a37bf23d4a6b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72081
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>