Implement new transform UnwindDiscardFunctions that replaces discard
statements with setting a module-level bool, adds a check and return for
this bool after every function call that may discard, and finally
invokes a single function that executes a discard from top-level
functions.
Regenerated tests and remove HLSL ones that used to fail FXC because it
had difficulty with discard.
Bug: tint:1478
Bug: chromium:1118
Change-Id: I09d680f59e2d5d0cad907bfbbdd426aae76d4bf3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84221
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
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>
Tests were moved to a new 'tint' subdirectory for the tint -> Dawn
merge, but these paths were not updated.
Also regen'd files for HLSL and a couple are no longer failing.
Change-Id: I11c315d948013ed30635d20e6da565450859cb03
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84341
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
These were deprecated in M98.
Fixed: tint:1312
Change-Id: Ieec17bfcc729f90d0a9aa8904a162167b9de54ed
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82800
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Note: ES doesn't support cube arrays, so this fixes the tests but does
not cause them to pass.
Bug: tint:1461
Change-Id: Ia2b1ffacab83dae58ac1b50eb04457da270d73e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82363
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
GLSL uses not() for vectors, and ! for scalars.
Bug: tint:1444
Change-Id: I7fa9bdf0b546224737f9cda18428dea7051fe9e5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82362
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
textureQueryLevels() and textureSamples() were being emitted with a
spurious semicolon.
Bug: tint:1222
Change-Id: I56c561fcaac510b76a27a850f5be522ab7f98307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82361
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
In GLSL, runtime-sized arrays are only valid in interface blocks, not
in structs. The existing code was attempting to avoid emitting structs
containing runtime-sized arrays but was confused by type aliases in
the AST resulting in arrays being missed.
The fix is to do the work on the semantic types instead, where type
aliases have been resolved.
Bug: tint:1339
Change-Id: I8c305ee9bddd75f975dd13f1d19d623d71410693
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82360
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Multiple bugs here:
1) Like texture(), GLSL's textureLod() on depth textures returns a
scalar, and does not need to be swizzled. So set glsl_ret_width to
1 in that case.
2) Like texture(), GLSL's textureLod() always requires a Dref
parameter, so append a zero if not present.
3) GLSL's "lod" parameter to textureLod() is always a float, unlike
WGSL's textureSampleLevel() which is an i32 for depth textures,
so cast it.
Along the way, I discovered that textureLod() is not supported on
samplerCubeShadow or sampler2DArrayShadow (even on Desktop GL). So some
tests will never pass. Logged as https://crbug.com/dawn/1313
Bug: tint:1456
Change-Id: If67d8d288704142278d7a4e52b46e8010776f381
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82300
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This change essentially relands 10c554ecf4,
aka https://dawn-review.googlesource.com/c/tint/+/82140.
(Somehow, I managed to revert most of that in the subsequent CL for
reverseBits. I suspect a bad upstream and/or rebase.)
Bug: tint:1430
Change-Id: Iba2688294dcd7d3008ee9da78957a7a464ca1c0f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
The '%' operator in GLSL is integer-only. Use the full OpFRem
expression: (a - b * trunc(a / b)).
Bug: tint:1270
Change-Id: I0a969983bef132e004ce456d4a738488e400a61b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
While Desktop GLSL supports the Coarse and Fine flavours, GLSL ES does
not. For now, emit dFdx/dFdy in all cases for ES, but excluding the
Coarse and Fine flavours via validation is also an option.
Bug: tint:1445
Change-Id: Iaac589f72043b5547e9141a6e870c1fd49631f6f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82142
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>