Commit Graph

810 Commits

Author SHA1 Message Date
dan sinclair 91ed6f7289 Add const-eval for `saturate`.
This CL adds const-eval for the `saturate` builtin.

Bug: tint:1581
Change-Id: I3729ea5b381b04b73bbe1bc8e03e5ce65c27e082
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107362
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-27 16:41:44 +00:00
dan sinclair c98ad87368 Add const-eval for `step`.
This CL adds const-eval for the `step` builtin.

Bug: tint:1581
Change-Id: Idbf773fb88892a8a5e620bcfe8b779dee148f746
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107281
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-27 15:32:45 +00:00
dan sinclair 59d9c89ff7 Add const-eval for `asin` and `asinh`.
This CL adds const-eval for the `asin` and `asinh` operators.

Bug: tint:1581
Change-Id: I18b2eeb4fb85b8979012b48551eefa773d1b980e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106980
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-27 15:10:20 +00:00
Ben Clayton a92f4259d5 tint/writer/msl: Move packed_vector hacks to transform
Attempting to paper over all the MSL standard library holes for packed_vector in the MSL writer added complexity to the writer, produced messy output, and didn't actually catch all the cases where casts were needed.

Add a new PackedVec3 transform that applies the packed_vector -> vec casts in a smarter, more precise way.

Fixed: tint:1534
Change-Id: I73ce7e5a62fbc9cb04e1093133070f5fb8965dce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
2022-10-27 14:36:49 +00:00
Ben Clayton 2e376a9bb0 tint/intrinsics: Allow mixing of signed / unsigned integer arguments
Fixed: tint:1733
Change-Id: Id83c5c5a59df062320a9a9fde087a34b85fbaa2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107160
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-26 18:47:02 +00:00
Ben Clayton 13f089095f tint/intrinsics: Texture queries now return unsigned integer / vectors
To match the spec.

Also add a bunch of missing texture test cases to
src/tint/ast/builtin_texture_helper_test.cc. Fix all the tests that were
broken because these were not being exercised.

Fixed: tint:1526
Change-Id: I207b51d307bbdc054b595e0e0e0fd3330607e171
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106681
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-26 18:36:44 +00:00
dan sinclair b3b027d3cd Update lexer to not include `-` in numbers.
This CL removes the parsing of a `-` in front of numerics when lexed.
This will cause the number to become a UnaryOperator negation then the
number instead of a negative number.

Bug: tint:1679, tint:1141, tint:1570
Change-Id: I217c0ffcbe5be934c8d56bd83141b47ade83bc60
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106463
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-26 15:20:47 +00:00
Zhaoming Jiang 4faf3581b8 Tint/builder/spirv: Fix atomicCompareExchangeWeak wrong return
This CL fix the spv code generated for atomicCompareExchangeWeak,
specifically the emulated `exchanged` field of the returned struct.
It should be true if and only if the `old_value`, i.e. the return value
of spv `OpAtomicCompareExchange`, equals to the comparator, rather than
equals to new value.

Fixed: tint:1663
Change-Id: I1cb0de6bb6b90ae681f5053b8bdd6f6b247146f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107180
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
2022-10-26 08:23:25 +00:00
Antonio Maiorano 25fdff1ff8 Unrevert "tint: rhs of left shift is always u32 or vector of u32"
Was failing e2e tests. Bug fixed in a parent commit.

Bug: tint:1713
Change-Id: I5cf20e6fd21e6358bb418f2ede7f4a7e0a61f138
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107141
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-25 23:37:07 +00:00
dan sinclair 4c8401f33c Add const-eval for `atanh`.
This CL adds const-eval for the `atanh` operator.

Bug: tint:1581
Change-Id: I7d8989a348ad1d8ca463dae90233fd82d6faf2d9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106849
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-25 18:03:56 +00:00
Ben Clayton bd5bd247f0 tint/resolver: Limit scope depth / if-chains.
DXC will bail if these get too deeply nested (~256).
This is also a risk for stack-overflows, so apply a limit agreed by the
WGSL working group.

Fixed: tint:1518
Change-Id: Idacdba85b36b27a0a89a3a7958fd4c6cce7dc84d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105964
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-10-25 16:53:06 +00:00
Ben Clayton 95dd428c75 tint/intrinsics.def: Add @test_value() annotation
Specifies the value to use for argument values when generating end-to-end tests.

Use this to provide a legal value for atanh().

Change-Id: I008050c856f9d687ab918c68e90678c4e74f3a1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106887
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-25 13:08:45 +00:00
Ben Clayton c3adc78cbc test/tint/builtins: Remove hack for 'level' parameter value
I'm sure this was needed at one point, but I can't seem to find the
requirement in either the spec or implementation. *shrug*

Change-Id: I8c139747c2a6864867ecda0b82a5f7991ad9d3ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106886
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-25 13:08:45 +00:00
Ben Clayton 6c33dce75a tint/test/builtins/gen: Fix i32 argument values
These were incorrectly abstract-int, instead of i32. Oops.

Change-Id: Iafac4883ee431b04fb473392f545ae26436f8343
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106885
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-25 13:08:45 +00:00
Ben Clayton da5424b617 tint: Allow signed / unsigned texture builtin params
Bug: tint:1526
Change-Id: I301a9ba6e94b162a1ffb436be3e3212b723b7401
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106682
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-24 23:58:53 +00:00
dan sinclair 20500b8e3a Add const-eval for `atan`.
This CL adds const-eval for the `atan` operator.

Bug: tint:1581
Change-Id: I3d9b417e86af010dc2f18c4e0424ddf971d55984
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106844
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-24 21:57:27 +00:00
Antonio Maiorano 087c355e08 Revert "tint: rhs of left shift is always u32 or vector of u32"
This reverts commit cc9ae5cae3.

Reason for revert: Kokoro failed on this CL

Original change's description:
> tint: rhs of left shift is always u32 or vector of u32
>
> Implements recent spec change:
> https://github.com/gpuweb/gpuweb/pull/3516
>
> Bug: tint:1713
> Change-Id: I678e3c15ec8ab010dca43fc814cf0bc79486f4b6
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106721
> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>

TBR=dsinclair@chromium.org,amaiorano@google.com,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I9d2337b77e2853c9e26300d0bfdbfba744c54c48
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: tint:1713
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106847
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-24 20:30:12 +00:00
Antonio Maiorano cc9ae5cae3 tint: rhs of left shift is always u32 or vector of u32
Implements recent spec change:
https://github.com/gpuweb/gpuweb/pull/3516

Bug: tint:1713
Change-Id: I678e3c15ec8ab010dca43fc814cf0bc79486f4b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106721
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-24 18:30:11 +00:00
dan sinclair 3a1b799585 Review feeback from 106420
Change-Id: I9c1ec7f26b0fda25bcedc86fec66d174fe81ed5f
Bug: tint:1633, tint:1451
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106843
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-10-24 17:49:20 +00:00
dan sinclair b8b0c21918 Add break-if support.
This CL adds support for `break-if` to Tint.

Bug: tint:1633, tint:1451
Change-Id: I30dfd62a3e09255624ff76ebe0cdd3a3c7cf9c5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106420
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: dan sinclair <dsinclair@google.com>
2022-10-20 22:45:50 +00:00
dan sinclair f8c07d4753 Add test for split of `--`.
An expression like `b--b` needs the `--` split into two symbols in
order to parse correctly. This change was done previously, adding
a test case to show the generated output.

Bug: tint:988
Change-Id: Id389224e33b7702a90e4c157b02031fb605c1b14
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106580
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-20 18:40:53 +00:00
dan sinclair 882b38a2f5 Update fallthrough deprecation notice.
The `default` case selector has been implemented in Tint. This CL
updates the deprecation notice with that fact along with some more
information on replacements.

Bug: tint:1644
Change-Id: I883b4465d11d9696d46523d11e66c9a2dc2777ac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106460
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-20 14:03:04 +00:00
dan sinclair 6e77b47ed9 Update internals to initializer instead of constructor.
This CL catches up the internals (along with a few error messages) to
say `initializer` instead of `constructor.

Bug: tint:1600
Change-Id: I8e56572c310d77da1130380bdd32b334f27c8e46
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106462
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-20 13:38:28 +00:00
Antonio Maiorano 1c94938726 tint: implement updated spec rules for shift left of concrete values
Rules for shift left of concrete values are now split between signed and
unsigned. Shifting unsigned values no longer fails with "sign change"
errors. Furthermore, shifting unsigned values must only shift out 0s.

See https://github.com/gpuweb/gpuweb/pull/3539.

Bug: tint:1701
Bug: tint:1717
Change-Id: Iba2799f4b02cdc77cc58a6c7c104aaa408f0f0f9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106381
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-19 17:46:12 +00:00
dan sinclair f148f0891b [WGSL] Allow default as a case selector
This CL updates the WGSL parser to parse `default` as a case selector
value.

Bug: tint:1633
Change-Id: I57661d25924e36bec5c03f96399c557fb7bbf760
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106382
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-10-19 15:55:02 +00:00
Antonio Maiorano b6e1bc7d5d tint: Fix C++ UB when shifting abstract 0 left by >= 64
In WGSL, we can shift left abstracts by >= 64, as long as the result is
representable in the data type we choose for it. When shifting 0, we can
shift by any positive u32 value (result is always 0), but in C++, it's
UB to shift by more than the bit width of the data type, so we need to
handle this. This bug was caught by ClusterFuzz.

Bug: chromium:1372963
Change-Id: I638ca190b93538908ca6472f3735627ea8531c5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106266
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-18 20:17:55 +00:00
Antonio Maiorano 79195ca42a tint/uniformity: implement analysis for full and partial assignments
As per https://github.com/gpuweb/gpuweb/pull/3298

Bug: tint:1703
Change-Id: I88eb40764473fdae52962b36df1b4a1c929603f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105000
Reviewed-by: Alan Baker <alanbaker@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-17 21:47:38 +00:00
Ben Clayton d360c1f9f5 test/tint: Add tests showing tint:1474 is fixed
Fixed: tint:1474
Change-Id: I462ae7bdb17a394b0a4c185fc815fe9727044555
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105963
Commit-Queue: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
2022-10-14 15:15:29 +00:00
Zhaoming Jiang 32718a5527 Tint/E2E: Fix testcases for bug/chromium/1367602
This CL rearranges testcases for E2E test/tint/bug/chromium/1367602,
now it has testcases for both function, private, and storage address
space array variable, with and without explicit initializer, and array
count less than 65536.

Bug: chromium:1367602
Change-Id: Ica0ec9c36586bc7eae0d46473575284e9b734092
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105282
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
2022-10-14 02:50:38 +00:00
Ben Clayton 559a248233 tint/resolver: Allow texture 'offset' to be const-expr
This allows the value to be declared in a `const` expression, and to use arithmetic.

Fixed: tint:1636
Change-Id: Ie641a9d4183429c79c91605cd4df78f569be3579
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105623
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-13 17:06:29 +00:00
dan sinclair d5139b4463 [msl] Handle packed conversions in shift expressions.
Similar to the handling of packed values in the arithmetic operators
the shift operators need to cast to the unpacked type before doing the
as_type casts.

Bug: tint:1542
Change-Id: I4289c45ab0a067ce122f61675fe5e251a83b6f8b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105720
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-13 15:28:51 +00:00
Ben Clayton 51cc480b69 test/tint: add test case for tint:1563
Demonstrates that this is not an issue.

Fixed: tint:1563
Change-Id: I5a33e6805cf0a5c52a6306f6d7e5949cee5636a5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105641
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-13 12:55:52 +00:00
Ben Clayton ba384f0383 tint/transform: Fix array materialization when indexing with override
Fixed: tint:1697
Change-Id: I6de9ea520e8e8fcba281c8cf68ad77021eb3dd22
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104825
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-12 19:18:25 +00:00
Ben Clayton d6daefc379 wgsl: Print abstract-floats with full precision.
Change-Id: Ie95547f065b896983b90ffd5455538fdd843b81a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104824
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-12 19:13:38 +00:00
Ben Clayton 933eb5159e tint: Add _tint_materialize internal builtin
Returns a materialization of the given argument.

Bug: tint:1697
Change-Id: Id25f7e10baa884047af21f89245884c551560f7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104822
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-06 19:54:07 +00:00
dan sinclair 8fd4ef26f5 Fix MSL packed_int casting.
In 104681 the vectors were cast to themselves to fixup an issue
with `packed_int`. That CL used an `as_type` which does a bit cast.
A `packed_int` can not be bitcast to an `int`. This CL changes to
a type cast, so instead of `as_type<int3>()` it does `int3()`.

Bug: tint:1677
Change-Id: I72218c06853e4e5ae1a0d34e2fc3e1ca597de993
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104682
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-05 17:49:00 +00:00
Antonio Maiorano 8800d885e7 tint: const eval of 'select' builtin
Bug: tint:1581
Change-Id: I222433acb6a30245ab319a15081811f691aca9ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104440
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-05 01:39:53 +00:00
Antonio Maiorano cf47d6147c tint: add parse_hlsl_errors.py to help triage hlsl errors
Change-Id: If160a8c72c407874060024c365faca83722b541f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-04 19:48:41 +00:00
dan sinclair 1dbda6f254 Update variables in address space template.
This CL updates the address space template to remove some usages of
`stoarge`.

Bug: tint:1404
Change-Id: I4c10f62886d2be4b03bce85dac9d58e3547ca60b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104423
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-04 19:44:48 +00:00
dan sinclair 66d3efb669 Limit array element count to less then 65536 elements.
This CL adds element count limits to arrays. In FXC there is a maximum
of 65536 elements in an array. This limit is not yet in WGSL, but adding
this here allows us to fix the issue with large arrays and GLSL.

Bug: chromium:1367602
Change-Id: I7df9d3e4f6c3e5107420d5f8e576d1f33e453161
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104240
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-03 17:25:42 +00:00
dan sinclair ff7cf21021 Rename StorageClass to AddressSpace.
This CL updates the internals to use AddressSpace instead of the old
StorageClass name.

Bug: tint:1404
Change-Id: Iecc208e839453437f4d630f65e0152206a52db7e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104420
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
2022-10-03 14:05:23 +00:00
dan sinclair 2bcade246a Update MSL generator to handle casts of packed types.
Currently in the MSL backend we cast int values to uint in order to get
the correct WGSL behaviour for over/under flow. This fails in the case
of host shareable buffers as they use `packed` types which need to get
cast to the non-packed version first.

Bug: tint:1677
Change-Id: I57b70abaa8ca614472a26d63f19c1aef2bd64668
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103986
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-09-29 19:44:58 +00:00
Antonio Maiorano 06844a5e24 tint/hlsl: remove [loop] attribute on all loops
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>
2022-09-29 16:53:58 +00:00
Antonio Maiorano dadb1fca0d tint: add e2e test for crbug.com/tint/1605
Bug: tint:1605
Change-Id: I6a94552110f4864dcd7fe011063fa35606104b48
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103984
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-28 14:03:49 +00:00
Antonio Maiorano 9b190f57c9 tint: add e2e test for crbug.com/tint/1604
Bug: tint:1604
Change-Id: I7005188a1b3b03934c55e54dc94f548c016166d1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103983
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-28 14:03:49 +00:00
Antonio Maiorano 451dcac7bc tint: delete e2e test with invalid SPIR-V
As per dneto's comment
(https://bugs.chromium.org/p/tint/issues/detail?id=804#c27), this is no
 longer valid SPIR-V, and fails in our spirv reader when validating.

Change-Id: I7d2e17b9b5ab827af19e08cb66ad15595a5bb3f5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103840
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-27 17:30:57 +00:00
Antonio Maiorano eea420871f tint: add e2e test for crbug.com/tint/1538
Bug: tint:1538
Change-Id: I3fecee57054813cbb7bc6b1343f373d504f631f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104021
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-27 17:30:57 +00:00
Antonio Maiorano 2323977745 tint: add e2e test for crbug.com/tint/1557
Bug: tint:1557
Change-Id: I48e09af3b265443a330248afe5377b76754aea33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104020
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-27 17:30:57 +00:00
Antonio Maiorano 4bffb56cca tint: Fix failing e2e tests due to updated spirv-val
These were marked as SKIP a couple months ago when vulkan-deps were
updated, and our spir-v reader started failing (see
https://dawn-review.googlesource.com/c/dawn/+/98020).

Change-Id: I1206fd5a941b38f00094ab00d0675cd46df77adf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103821
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-09-26 20:21:25 +00:00
Antonio Maiorano 5b0bab84be tint/fxc: regen e2e tests that are not actual FXC timeouts
- write-before-break/0-opt.wgsl/spvasm compiles correctly and quickly.
- cov-multiple-one-iteration-loops-global-counter-write-matrices\0-opt.wgsl/spvasm fails with a different FXC error.

Change-Id: Ic0d57494bac8d4ca423fbdcd7bca7e918935b522
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103761
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-09-26 15:17:45 +00:00