I added the forcing of the "loop" attribute to all loops to address FXC
failing on uniformity errors related to gradients in loops. Since then,
Tint now implements UA and it recently became an error, so we no longer
need this hack. As a result, FXC is now better able to cope with loops
that it determines executes 0 times.
Most e2e tests are affected because so many use loops, but 27 tests that
were previously failing are now passing with this change:
tint/bug/tint/1538.wgsl.expected.fxc.hlsl
tint/bug/tint/1604.wgsl.expected.fxc.hlsl
tint/bug/tint/1605.wgsl.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl
tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl
tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl
Bug: tint:1522
Bug: tint:1538
Bug: tint:1604
Bug: tint:1605
Change-Id: I530b846b6b8df122ab351ff7b85d3e1c9ac11526
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104121
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Since GLSL ES does not support the offset= attribute, struct members
with explicit @align or @size attributes require adding explicit
padding members. This in turn requires rewriting any constructor
calls to initialize the new padding to zero, handled in the same
transform.
Note that this is currently overly-verbose, and will add padding where
GLSL doesn't technically need it (e.g., padding a vec3 out to 16 bytes).
Bug: tint:1415
Change-Id: Ia9ba513066a0e84f4c43247fcbbe02f5fadd6630
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101720
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Modify the AddSpirvBlockAttribute transform to fix top-level structure
access of uniform, storage and push-constant buffers for use in the
GLSL backend. The small change to the transform makes the transform
wrap host-sharable buffers, if they're also used as a
non-host-sharable structure. Also rename the transform to
AddBlockAttrbibute in order to reflect its wider applicability.
Change-Id: Ib2bf4ebf6bce72790791dbae9387032be765e4b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101061
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Change tint's `--fxc` flag to take the path of the FXC compiler DLL.
Have tint attempt to validate with both FXC and DXC if `--validate` is
passed.
Fix the 'dirsWithNoPassExpectations' logic which looks like it got
broken with the tint -> dawn merge. It also incorrectly applied
filepath.FromSlash() on windows.
Change-Id: I0f46aa5c21bc48a2abc48402c41f846aff4a8633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96800
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Enable the parsing of 'const'.
Warn on use of module-scope 'let', and automatically replace with 'const'.
Fixed: tint:1580
Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
And remove the WrapArraysInStructs transform.
Wrapping arrays in structures becomes troublesome for `const` arrays, as
currently WGSL does not allow `const` structures.
MSL 2.0+ has a builtin array<> helper, but we're targetting MSL 1.2, so
we have to emit our own. Fortunately, it can be done with a few lines of
templated code.
This produces significantly cleaner output.
Change-Id: Ifc92ef21e09befa252a07c856c4b5afdc51cc2e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94540
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
Aside from more SPIR-V using OpConstantNull, this is a no-op change.
By refactoring these methods, they're easier to read, and contain less
lambda-heavy code.
Change-Id: I89c26b2b9f1cd0785d86fb3293f7cfda550bef2e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94331
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL updates all of the Tint unittests to the new @stage shorter
syntax. This also updates the WGSL writer to emit the new short forms
instead of using the deprecated form.
Bug: tint:1503
Change-Id: I8c49e5319a19cccb5b4b5078f3ab39c50f31a9a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92483
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: If0a49e9b03566c06aa6e4e4c284fc427e1541e91
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92082
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: I79ad567954de2d1cfea09dda255894e4e2aa678e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92081
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: Ic3ac62317241fa6f7009360128f222aeb56f62e4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92083
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This is required to handle materialized values, and for constant
expressions.
Bug: tint:1504
Change-Id: Ie0177f148e08a0e1a3f4d7e06e283f121655804b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92080
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
If the literal was constructed with an 'f', make sure we print it.
Bug: tint:1504
Change-Id: I6f04e31a166919c07574db56b0a2063ce5b8ca5c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91965
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
The OpenGL ES 3.1 spec says:
"The point size is taken from the shader built-in gl_PointSize written by the vertex shader, and clamped to the implementation-dependent point size range. If the value written to gl_PointSize is less than or equal to zero, or if no value is written, the point size is undefined."
ANGLE/D3D11 will emit a warning on this and abort processing, causing dawn_end2end tests to fail.
Bug: dawn:1390
Change-Id: I6a56467842ba80d8a070af7240ee07bb111089dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Use of semicolons is still supported, but deprecated.
Also updates the parsing methods for structures to better match the
WGSL grammar.
Bug: tint:1475
Change-Id: I7675ba42c13f91080b0ac173c352e0092021f80b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>