This extension adds support for the push_constant storage class such
that it can be tested with WGSL test files. The real goal is to allow
future transforms that will add push constants that the SPIRV writer
will output.
The extension:
- Adds the `chromium_experimental_push_constant` enable.
- Allows the push_constant storage class for global variables.
- Adds validation that the types are host-shareable for push_constant
variables, and that they don't contain f16 (must be 32bit types
only).
- Validates that at most one push_constant variable is statically used
per entry-point.
- Skips validation that the extension has been enabled if
kIgnoreStorageClass is used.
Tests are added:
- For parsing of var<push_constant>
- Caught a missing conversion.
- For each of the validation rules.
- For the wrapping of push constants in structs if needed by
AddSpirvBlockAttribute.
- For the layout and type rules of the storage class.
- For a shader with multiple entry-points using various push constants.
- Caught a missing reset of the previous push constant variable in
the validation check that at most one is used.
- Caught the missing wrapping in structs that had to be added to
AddSpirvBlockAttribute.
- Caught incorrect logic when adding diagnostics about the call
graph leading to the reference to push constants.
Bug: tint:1620
Change-Id: I04a5d8e5188c0dcef077f2233ba1359d1575bf51
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96682
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
It's not automatically cleared to empty when moving on ChromeOS, so
the same mDeleter can be executed more than once.
Bug: chromium:1348193
Change-Id: If96a73f0b9bf62b2212a9f47108c465d6c911617
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97865
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Metal implementation is more complex and has more issues, submit D3D12
and Vulkan frist and another CL for Metal.
Bug: dawn:1250
Change-Id: I718d323e01bb41b0209bfd1f1026faf64b4f1076
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97640
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
As suggested in an emscripten update,
VertexStepMode::VertexBufferNotUsed will be undefined in jsrepr
in generated files.
Bug: dawn:1000
Change-Id: I3ad96f66f2965d6aa589174225eee538ec97d060
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97900
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Check the result of Materialize() for an index accessor.
Bug: chromium:1347541
Change-Id: Iac1b030a1923c96d65d531a0ca5fd1f4bd4271b9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97851
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
If the array constructor has no explicit type and count, infer from the
arguments.
Implement and test array materialization.
Also:
* Change sem::AbstractNumeric::IsConstructable() to return true. This
has changed in the WGSL spec.
* Fix the test-helper builder for DataType<array<N, T>> - it was
incorrectly calculating the array size.
Bug: tint:1628
Change-Id: I0ec4e55b469ca6423b4d1848f27bb11df4fa683b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97663
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This transform was attempting to remove builtins with no side
effects, such as a call with abstract int/float args, which is unhandled
by this transform. For example, this would cause the transform to ICE:
_ = clamp(1, 2, 3);
Fixes ClusterFuzz issue crbug.com/1348739.
Bug: chromium:1348739
Change-Id: Ie355eb36c6c020417c2d93f2dc434c11dbb72d1f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97880
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Rename tests to remove redundancy.
Add missing 'Source' flavoured constructors to ProgramBuilder. Use them.
Change-Id: I9a41db2ebc8fdc12e2654836247370844990272a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97662
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Just checking whether the count is nullptr is not sufficient to know
whether the array is fixed-size:
`array` represents a infered type, infered fixed-size array
`array<T>` represents an explicit type, runtime-sized array
`array<T, N>` represents an explicit type, explicit fixed-size array
Bug: tint:1628
Change-Id: I03f547078c015d1d2a8a38308bb5e41c733715ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97589
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
The resolver has sensible places to dispatch to ArrayConstructor() and
StructureConstructor(), so don't do additional, unnecessary type
dispatches.
Change-Id: Id4edb1fc0dedf431d94507b1c3378bca164746a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97588
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
In preparation for array constructors that can infer type and count
based on constructor arguments.
Bug: tint:1628
Change-Id: I9f12d7a30de232cf0d34ed7e1a356dd5b92d26d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97587
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
2D Array texture might corrupt on some devices, making out-of-bound
texture access and memory information leak from another texture.
This is a critical security issue.
This change aim at mitigating the security issue via allocating
sufficent extra memory for each texture allocation for 2D array
texture on such devices.
Bug: dawn:949
Change-Id: I3629eeb13be872b2107effa55539e5c24522d0fc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96220
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Adds random swizzle operations to candidate vector expressions.
Also excludes certain common keywords from the set of identifiers that
are matched by the regex fuzzer, which will serve to make other
mutations performed by the regex fuzzer more preise.
Fixes: tint:1619
Change-Id: I10b6937f2c6f7341ec4a85d3b7ab56b3a36ef169
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96780
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <allydonaldson@googlemail.com>
Required for arrays of, or nested arrays of abstract-numerics,
abstract-numeric vectors and abstract-numeric matrices.
Bug: tint:1628
Change-Id: Ib360c687163d3b88be780fdbc2d3eb1a93689520
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97585
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This should be immutable once the sem tree is built.
Add a hacky const_cast in Resolver for now, as this is preferable to
having some things non-const in sem.
Bug: tint:745
Change-Id: I67ebce76730347c9543875ab8e1c21a47d71fd56
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97584
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Instead of a C-style array.
Change-Id: Ieb3e9811cddf505bfd3b484b7f265459f7b0e66b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97583
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Add Resolver::ConcreteType() to determine the concrete type for an
abstract-numeric (or composite of abstract).
Will be used to recursively infer the concrete types of abstract arrays.
Bug: tint:1628
Change-Id: Ia26b778abc827b531848b346f3e36938ad1a0470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97582
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This tracks the WGSL spec and reduces tint complexity.
Change-Id: I240a87fc7bb7f51d9e0ff180af4911cd00a33758
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97581
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This patch add f16 support for a major part of numeric built-in, and
implement corresponding unittests for resolver and backends. This patch
also enable f16 constant evaluation for unary minus operator, `atan2`
and `clamp`.
The following numeric built-ins are not supported yet:
* frexp
* modf
The end-to-end tests for f16 built-in are not added yet.
Bug: tint:1473, tint:1502
Change-Id: If807185617b21c510a1a9c371179a60800c4f875
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96722
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This patch clean up the writer/spirv/builder_builtin_test. The major
changes are:
1. Group the testcases by built-in types (array built-ins, logical
built-ins, derivative built-ins, texture built-ins, etc.), and put each
types in a namespace, which may help reading the code.
2. Make sure all tests for numeric built-in use variable rather than
literal as input, in order to prevent supporting constant evaluation for
these built-ins break the unit tests.
3. Make float type (`f32` for now) explicit in test names for float
built-ins, to help implementing corresponding f16 testcases.
Bug: tint:1473, tint:1502
Change-Id: I6a1ad5fe24729d36d01f4fd570bfae5fae7351ed
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97384
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Bug: dawn:1480, dawn:1481
Change-Id: If61f0466d79e7759ed32c4ddf541ad0c17247996
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96904
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Storing values into the cache will need to serialize and deserialize
values in addition to keys. This patch factors the serialization
utilities out of CacheKey into a more general "Stream" utility that
supports both input and output for serialization and deserialization.
Multiple files are not renamed to make parsing the diff easier. They
will be renamed in Change If61f0466d79e7759ed32c4ddf541ad0c17247996.
Bug: dawn:1480, dawn:1481
Change-Id: If7594c4ff7117454c1ab3d0afaeee5653120add8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96480
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Do not assign null to the wgpu::Device, as this will result in a nullptr dereference if you attempt to use the device after destruction.
The wgpu device correctly handles the error state of being used after destroy().
Fixes crashes of CTS tests:
'webgpu:api,validation,state,device_lost,destroy,*'
Change-Id: Ibee1078436efadf25f53735fbaa47d5fc5f74898
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This patch clean up the resolver/builtin_test. The major changes are:
1. Group the testcases by built-in types (array built-ins, logical
built-ins, derivative built-ins, texture built-ins, etc.), and put each
types in a namespace, which may help reading the code.
2. Rewrite the parameterized tests for float and integer built-ins, i.e.
numeric built-in overloads that take at least one float parameter and
all integer parameters. Built-ins that may take either float and integer
parameters, e.g. `abs`, `min` and `clamp`, are tested in both testsuits,
rather than having a third testsuits.
3. Stop checking the detailed candidate lists for float and integer
built-ins in parameterized testsuits.
This patch is helpful for implementing f16 built-ins.
Bug: tint:1473, tint:1502
Change-Id: I23d46a7b0ac2ef4a35d4aa462ede39025ba92158
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97382
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Makes the tint public API use the same standardized way to identify overrides.
Bug: tint:1155
Bug: tint:1582
Change-Id: Ib25d9ed5d41844486581e088add24b9131f5f4bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97007
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>