This CL moves switch case statements to store Expression instead
of an IntLiteralExpression. The SEM is updated to store the
materialized constant instead of accessing the expression value
directly.
Bug: tint:1633
Change-Id: Id79dabb806be1049f775299732bc1c7b1bf0c05f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106300
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This change required removing the `&&` splitting for `a & b && c` which never valid WGSL (right now).
Fixed: tint:1658
Change-Id: Ideb9f1aa9cf9b9b1054a6fc65860106dc072a9dc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105820
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
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>
The SwitchStatement has an IsDefault method which checks if the
condition is nullptr. The method is never called, and default
cases are tracked in the CaseStatement class, so it's questionable
what IsDefault even means here.
Change-Id: I96e97fbbf4823df3e92d2440fa6a9541a5ba337f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106280
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
The reason for slow compile times is because the very large variants of
builder::Value<T>s combined with the many std::visits over these
variants result in many combinatorial instantiations of the visit
callbacks.
To address this, I added a polymorphic base class ValueBase to Value<T>,
and replaced most of the std::visit-based compile time code with runtime
virtual calls. For the two heaviest users of std::visit over the large
variants, compiles times dropped more than half (clang-10, debug):
const_eval_binary_op_test.cc: 19.079s to 7.736s
const_eval_unary_op_test.cc: 10.021s to 4.789s
Bug: tint:1711
Change-Id: Iba05e6ae1004ef0814250e2a8ea50aa2b26b85f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105782
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This CL updates the @location attribute to use expressions instead of
integers.
Bug: tint:1633
Change-Id: If4dfca6d39e5134bb173209414ad8d2528c8095d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106121
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This CL updates the @id attribute to use expressions instead of
integers.
Bug: tint:1633
Change-Id: I3db9ab39f10a7f50f8d1e418ec508d4e709a24ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106120
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Standardize how we refer to @size, @align and @offset.
Change-Id: I14d462a7e96e35e6c3d6dc5a11cc09f9a95eca15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106200
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This is cruft left over from file name collisions between ast / sem,
which has been resolved by splitting the build targets.
Change-Id: I0d65ffe97fed7095b37cc91a506dd05a20cda76a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106222
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Passing now on our infra, starting in MacOS 10.13.
Chromium has also dropped support for 10.12.
Bug: dawn:39
Change-Id: Ied22c00ffdcfa7c2ae4f122af8721defc2bbc5aa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106020
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Austin Eng <enga@chromium.org>
Variables can be declared in more than just BlockStatement.
For example, for-loops can declare a variable.
Change this to be a map instead of a vector. This helps with lookups.
Change-Id: Ic9429425af70e9535c21cc0875b875f145724266
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This CL add a `Backend::IsDXCAvailable` method that check not only the
DXC binary is available but also its version is no older than a given
minimum version, and use this function to replace all previous
`PlatformFunctions::IsDXCAvailable` to ensure that we always check the
DXC version. By giving the minimum version 1.4, this CL also forbid
using DXC older than 1.4.
Issue: tint:1719
Change-Id: I6ab0a3791ac734c4e8b13570c55194573f111e61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105900
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This CL updates the @group and @binding attributes to use
expressions instead of integers.
Bug: tint:1633
Change-Id: I91068874c104d5b84390f1617cb96265dda6e1e0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105801
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This CL updates the size attribute to parse expressions.
Bug: tint:1633
Change-Id: Ia12650848e7041faa53013d195f4313b8d3e9969
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103320
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This patch fixes the shaders used in ShaderRobustnessPerf tests by
replacing the deprecated "let" with "const".
Bug: dawn:594
Test: dawn_perf_tests
Change-Id: Ife3d03f40404963193fd79c05649334f52154f1a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105921
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
If they're not supported by the backend, print an error that includes the line that enables the extension
Fixed: tint:1678
Change-Id: I3732bfba92a8f96c9e5613c5da6f0e197352508f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105760
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Override values no longer need to be a literal.
Use the constant value to infer the initializer value.
Bug: chromium:1362256
Change-Id: Ie0eef49291c568fef2197dfa91fcb5f3e3197d65
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105960
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>
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>
No longer failing on our test infrastructure.
Bug: dawn:838
Change-Id: I70168d89fb56218e2bc9b20c7fbe95b791cbdeb0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105781
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Loko Kung <lokokung@google.com>
Auto-Submit: Austin Eng <enga@chromium.org>
The single file was taking too long to compile, and was becoming
difficult to work in.
Bug: tint:1711
Change-Id: Ibaaa5dd72aef02cdffe80156848d010ff84c9553
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105740
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Raise the error on the inner-most expression that violates the required evaluation stage.
Fixed: tint:1655
Change-Id: I82186e72ed6efa1cd6d4456c04446da18e9f1850
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105640
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
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>
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>