Commit Graph

30 Commits

Author SHA1 Message Date
Ben Clayton 52f852fa28 test/tint: Regenerate SKIP expectations
`./test/tint/test-all.sh ./out/active/tint --generate-skip`

A bunch of these got missed by https://dawn-review.googlesource.com/c/dawn/+/98020, as I assumed only `glsl` and `spvasm` backends would be affected.

Some are just refreshes of existing skips

Bug: tint:1632
Change-Id: I1b003a56143b52e8e47bef8a10fec2878a48be06
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98120
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-08-03 09:47:48 +00:00
Ben Clayton 0fba14e3c6 tint/val: Make DXC validation output stable
Replace the temporary file name with 'shader.hlsl', so that
skip-expectations can be stably re-generated.

Change-Id: I5ead2235e6e0d84ad67c8d90f8d06b812c8fd593
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97145
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-07-26 14:23:24 +00:00
Ben Clayton 7d34de88f1 tint/test-runner: Split expectations for FXC and DXC
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>
2022-07-22 17:43:27 +00:00
David Neto 760c399cfb Delete tests with invalid SPIR-V inputs
The structured CFG rule was revised/clarified in SPIR-V 1.6 Rev2
Validation now rejects a few cases.

SpvParserTest, ValueFromBlockNotInBlockOrder
SpvParserFunctionVarTest, EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored
SpvParserFunctionVarTest_EmitStatement_Phi_ValueFromBlockNotInBlockOrderIgnored
  - Originally from crbug.com/tint/804
    Invalid by SPIR-V 1.6 Rev2 update to validation rules:
     - Block 80 is a structurally reachable continue target
     - Block 25 is not structually reachable, and not part of the loop,
       but branches to 80.

vk-gl-cts/graphicsfuzz/cov-dead-branch-func-return-arg/0-opt.*
  -  The continue construct with the continue target 37[%37]
     is not structurally post dominated by the back-edge block 64[%64]
  - The SPIRV-Tools inliner no longer creates such cases.  It splits the
    single-block loop and pushes the continue target down.

vk-gl-cts/graphicsfuzz/nested-for-loops-with-return/0-opt.spvasm
  - The loop headed at block 46 does not structurally dominate its merge
    block 44.  There is a continue-target edge from 41 to 44.

SpvParserCFGTest_ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader.spvasm
SpvParserCFGTest_EmitBody_Loop_MultiBlockContinueIsEntireLoop.spvasm
SpvParserCFGTest_LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue.spvasm
SpvParserCFGTest_SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop.spvasm
SpvParserCFGTest, ClassifyCFGEdges_BackEdge_MultiBlockLoop_MultiBlockContinueConstruct_ContinueIsHeader
SpvParserCFGTest, EmitBody_Loop_MultiBlockContinueIsEntireLoop
SpvParserCFGTest, LabelControlFlowConstructs_MultiBlockLoop_HeaderIsContinue
SpvParserCFGTest, SiblingLoopConstruct_ContinueIsWholeMultiBlockLoop
 - Continue target 20 also its own loop header, but is not structurally
   post-dominated by the backedge block.
 - Delete the end-to-end test.
 - Keep the unit test because it's about classifying edges, but disable dumping
   into the end2end suites.

Change-Id: I9ec2504aadd2fec9ea463901af7dc1b5f47481b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95580
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: David Neto <dneto@google.com>
2022-07-06 01:45:30 +00:00
dan sinclair b29892be09 Update src/tint unittests to new @stage format.
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>
2022-06-07 13:55:34 +00:00
Ben Clayton 16175ac2df tint: Remove use of inf / nans from e2e tests
We're not supporting these, even as hex-floats. Replace them with finite
float values.

Bug: tint:1504
Change-Id: Id5e304d2bdd79576b68b43a1afb5cce2cd6ad01a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91967
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-05-31 21:35:00 +00:00
Antonio Maiorano b0d9c15821 tint: Remove skips for tests that now pass latest DXC
Bug I filed at
https://github.com/microsoft/DirectXShaderCompiler/issues/4422 has now
been fixed by
https://github.com/microsoft/DirectXShaderCompiler/pull/4446.

Kokoro always uses the latest DXC build, so this should now pass.

Bug: tint:1523
Change-Id: Ib19a04fc936b45001c3a56b0499fb4fd43e96db8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91600
Auto-Submit: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-05-26 13:06:55 +00:00
Antonio Maiorano b909d5554d tint: Update SKIP lines with specific FXC bug
Error is:
internal error: compilation aborted unexpectedly

Bug: tint:1521
Change-Id: I482699d43001a95673bf44d97f5be314a3e69be2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88401
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-04-29 15:31:22 +00:00
Antonio Maiorano bdd2bc9750 tint: Update SKIP line for specific DXC failure
For error "access violation. Attempted to read from address
0x0000000000000048", added link to GitHub issue I opened. Helps to
understand what these errors are when reading the expectation files.

Bug: tint:1521
Change-Id: Ie2a1693f021e17586a4fe3b4dfe652bbdc877c49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88363
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-04-29 15:31:22 +00:00
Antonio Maiorano 0da5e8b35d tint: regen skips for hlsl files that were missing error message in the output
Also mark all the skips for time out the same way for easier grepping.

Change-Id: Ie071df30431bded7838205c3a18483a5233687c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88341
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-04-28 15:11:03 +00:00
Stephen White 790e4c2d60 GLSL writer: emit gl_PointSize = 1 in all vertex shaders for OpenGL.
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>
2022-04-22 21:25:02 +00:00
James Price 0384932f1a tint: Replace smoothStep with smoothstep in tests
There were some tests that were still using the deprecated name, as
was the SPIR-V reader.

Bug: tint:1483
Change-Id: Ie919596712e05340110fbd872470a1b4c9a625c7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86745
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
2022-04-14 19:49:10 +00:00
Ben Clayton 4d36557bce Normalize all line endings to LF
And force shader code to always use LF endings.

Post merge, there were a number of files that crept in with CRLF endings.

Some Tint end-to-end tests take objection to CRLF endings.

CRLF endings can be detected with:

```
git grep -I --files-with-matches --perl-regexp '\r' HEAD
```

And fixed with:

```
find . -type f -exec dos2unix {} \;
```

Bug: dawn:1339
Change-Id: Iee054bafd15875de744b86e28393cd8229bd3cfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86140
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-04-08 14:18:28 +00:00
Antonio Maiorano b349710476 HLSL: workaround FXC error "continue cannot be used in a switch"
Added a new transform::RemoveContinueInSwitch that replaces continue
statements in switch cases with setting a bool variable, and checking if
the variable is set after the switch to continue.

Bug: tint:1080
Change-Id: I3c0a6c790e1bb612fac3f927a4bd5beb2d0d4ed1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84960
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-03-31 15:02:25 +00:00
Antonio Maiorano 66d6668372 Implement discard semantics
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>
2022-03-28 20:51:32 +00:00
Ryan Harrison 3374f43c31 Normalize DEPS to ease merging with Dawn
- Format specific targets to have the hash in the target rule instead
  of a variable.
- Only have the base part of the URL in a variable
- Use vulkan-deps instead of individual DEPS (spirv-tools,
  spirv-headers & glslang)

BUG=tint:1481

Change-Id: I871a656e26050698da2c77f4f39fec94a9c4f8a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84723
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>
2022-03-28 18:01:02 +00:00
James Price 3b671cb377 wgsl: Separate struct members with commas
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>
2022-03-28 14:31:22 +00:00
Antonio Maiorano 7419f0e26a Fix test-runner not skipping dirsWithNoPassExpectations
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>
2022-03-23 15:10:22 +00:00
James Price 1a72a76e4f test: Regenerate vk-gl-cts WGSL sources
This removes @stride, which will soon be invalid.

Bug: tint:1381
Change-Id: I3cbe987edb9b918b2f344b92a4f0fe4838df4a80
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/83962
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-03-21 16:09:17 +00:00
James Price bcd9ad2ebb Remove isNan, isInf, isFinite, and isNormal
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>
2022-03-05 00:39:14 +00:00
Stephen White 66abf3ed14 GLSL: don't emit structs w/runtime-sized arrays.
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>
2022-03-02 14:09:22 +00:00
Stephen White 4acf466ff9 GLSL: fix countOneBits().
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>
2022-03-01 14:25:42 +00:00
Stephen White bee5fa6881 GLSL: implement pack/unpack builtins.
Bug: tint:1428
Change-Id: Ic1db31feb6c6da4a98f6a37b40c77be887662825
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82200
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-28 21:19:02 +00:00
Stephen White 59f1e8d06c GLSL: special-case BinaryOp::kModulo for floating point.
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>
2022-02-28 21:15:02 +00:00
Stephen White 7028077a6a GLSL: implement inverseSqrt() and update test expectations.
Bug: tint:1447
Change-Id: I521d021a9177c75badd52ad39ce4db6def48b6ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82144
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-28 18:23:17 +00:00
Stephen White 2a02b68453 GLSL: implement fract() builtin function.
Bug: tint:1446
Change-Id: Icb06bb560956372a689db33c758b3d5ad8c27225
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82143
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-28 18:19:47 +00:00
Stephen White ba4d6ab01d GLSL: implement derivative instructions.
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>
2022-02-28 18:08:13 +00:00
Stephen White 3b68fcb544 GLSL: implement reverseBits().
Bug: tint:1431
Change-Id: I816ce26e98705f459e2fbc652d06d6fc97bab7fb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82141
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-28 17:43:37 +00:00
Stephen White 10c554ecf4 GLSL: implement countOneBits().
Bug: tint:1430
Change-Id: I1aa886d1f68e50f0ce6fd5b55d87722742ca5f69
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82140
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-02-28 17:41:47 +00:00
Ryan Harrison dbc13af287 tint->dawn: Shuffle source tree in preperation of merging repos
docs/    -> docs/tint/
fuzzers/ -> src/tint/fuzzers/
samples/ -> src/tint/cmd/
src/     -> src/tint/
test/    -> test/tint/

BUG=tint:1418,tint:1433

Change-Id: Id2aa79f989aef3245b80ef4aa37a27ff16cd700b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80482
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2022-02-21 15:19:07 +00:00