Commit Graph

292 Commits

Author SHA1 Message Date
Antonio Maiorano 1abe52dc1c tint: const eval of firstLeadingBit
Bug: tint:1581
Change-Id: I33c87ced173938bcd16e00debdd5c6682b4a9426
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107763
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-10-31 20:34:36 +00:00
Antonio Maiorano 76c21c070b tint: const eval of countOneBits
Bug: tint:1581
Change-Id: I156cbd162010d28ec25b410220638e810fc34c98
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107701
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-31 18:44:15 +00:00
Ben Clayton 6dbb463f1d tint/writers: Polyfill integer clamp()
...to `min(max(e, low), high)` as defined by the WGSL spec.

Fixed: tint:1479
Fixed: tint:1539
Change-Id: I39406d5256a155a781e44bd9d6081ce7a9bf5a68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107640
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-10-31 17:54:49 +00:00
Ben Clayton be83128031 tint/transform: Don't hoist textures / samplers
in the PromoteSideEffectsToDecl transform

Fixed: tint:1739
Change-Id: Iaa5a6e086708a6bba601c59962042650829795f6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107683
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
2022-10-31 17:33:35 +00:00
Ben Clayton 22c4850b06 tint/resolver: Allow array sizes to be unnamed override-expressions
I got the rules around this wrong. This should be allowed, but the array types cannot compare equal if they are unnamed override-expressions.

Fixed tint:1737

Change-Id: I83dc49703eed015e9c183e804474886da5dad7b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107685
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-31 17:26:10 +00:00
James Price 3e1bc0a6da tint: Use MergeReturn transform in SPIR-V backend
Bug: tint:1627
Change-Id: I5a3639543b076e6f666bfcca8c61b22db7f2630e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107363
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-10-31 15:41:41 +00:00
dan sinclair 8a523d7d8e Add const-eval for `any`.
This CL adds const-eval for the `any` builtin.

Bug: tint:1581
Change-Id: I32d8946b3cd5c6d210b75104fa37c4d1ef6a6f84
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107542
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
2022-10-29 16:21:24 +00:00
Antonio Maiorano 7494e10f91 tint: const eval of countTrailingZeros
Bug: tint:1581
Change-Id: I2967ea1d6f3f297c03795bddd0e26abcccd57184
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107700
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-29 14:02:38 +00:00
Antonio Maiorano 2be5167e3e tint: const eval of countLeadingZeros
Bug: tint:1581
Change-Id: Ib7ae9f36dad64c1eed3ce223af47e92aa0a663f1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107661
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-10-29 14:02:38 +00:00
Ben Clayton 46de10299f tint/transform/builtin_polyfill: Don't polyfill @const builtins
We don't want to replace builtins that are constant-expression
evaluated, as the replacement cannot be used as a constant expression.

Fixed: tint:1667
Change-Id: I554d9884fc41890247ee64b47a70621be5fcdbe5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107680
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2022-10-28 20:46:07 +00:00
Antonio Maiorano 2048d4f6ef tint: fix identity initializer of vec from vec of abstract not remaining abstract
For "vec3(vec3<T>) -> vec3<T>", this CL makes T also include abstract
int and float (all scalars).

Bug: tint:1731
Change-Id: I776c7ba6872c3d680982dbec6b0970389e720611
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2022-10-28 15:58:38 +00:00
dan sinclair c395660ee6 Add const-eval for `sign`.
This CL adds const-eval for the `sign` builtin.

Bug: tint:1581
Change-Id: I5d9bfd3f3f742bcba69fbb0d7f47dc57ce18e134
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107460
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-10-28 14:56:50 +00:00
dan sinclair fd1b5a893d Set specific test value for asin test cases.
The value of 1 for the `asin` is providing a slightly different result on OSX
compared to the Windows and Linux results. This CL updates the test case to use
asin(0.479425538604) = 0.5

Bug: tint:1581
Change-Id: Ibf7a921d1476c0d24da696eb6cc2b491c1ca1516
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107541
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
2022-10-28 12:31:08 +00:00
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