Commit Graph

18 Commits

Author SHA1 Message Date
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