Add validation and execution tests for chained swizzles on the LHS of an
assignment. These are valid with the swizzle_assignment language feature
as long as the final indices actually assigned are free from duplicate
targets.
Bug: crbug.com/539634915
Array-like indexing into swizzle views was added to the swizzle
assignment WGSL language feature specification in a recent change to the
spec PR:
4b8daf8f0c
The swizzle assignment spec was updated so that creating a SwizzleView
from pointer requires support for pointer_composite_access, so CTS tests
here are updated to correctly handle the interaction between
swizzle_assignment and pointer_composite_access. Execution tests for
swizzle assignment via pointer are now skipped if the
pointer_composite_access language feature is not available, and
validation tests are added to validate both cases.
Bug: crbug.com/534329233
* Add 'texture-compression-unaligned' feature name.
* createTexture tests pass when texture-compression-unaligned feature is supported.
* Add test to ensure createTexture with unaligned extents fails without texture-compression-unaligned, but succeeds otherwise.
* Add test to validate correctness of copyTextureToTexture for block compressed textures with unaligned sizes.
* Validate correctness of image copies of compressed textures with unaligned dimensions.
* Fix test `texture_size,3d_texture,compressed_format`.
* Remove code using the listing_meta.json file.
This CL removes the infrastructure which validates and uses the
listing_meta.json file. The listing_meta.json file itself will be
removed in a followup CL.
Issue: #4592
* remove chunked2sec
* run lint fix
* fix lint warnings
* Restore case count report
This patch extends type validation for the `immediate` address space.
The pointer tests cover `ptr<immediate>` parsing, missing store types,
invalid access modes, read-only pointer use, and immediate store types
that must be rejected, including arrays and atomics.
The type suites also recognize `immediate` as an address-space
enumerant and check that `ref<immediate, T>` is not a nameable type.
This patch bumps @webgpu/types to 0.1.71 with below changes:
- `setImmediates` is a required method.
- `maxImmediateSize` is a required property.
- `subgroup-size-control` is a valid `GPUFeatureName`.
* Add declaration tests for WGSL immediate variables
This patch adds a focused declaration suite for `var<immediate>`.
The new tests cover accepted scalar, vector, matrix, and struct store
types, rejected store types, module-scope-only declarations, rejection
of binding attributes, rejection of explicit access modes, and the
one-immediate-variable-per-entry-point rule.
It also threads `immediate` through the existing declaration tests so
the generic address space coverage checks the same declaration access
rules as storage, uniform, private, workgroup, and function variables.
The context-dependent resolution table now recognizes
`immediate_address_space` as a language feature name.
* Treat f16 immediate store types as valid per spec
The WGSL spec allows f16 in the immediate address space: f16 is a
host-shareable constructible scalar, and immediate store types only
exclude arrays and structures containing arrays. Remove the f16
immediate skip so the validation tests assert the spec-correct result
(f16 immediate compiles). An implementation that rejects f16 immediate
is non-conformant and will be flagged by these tests.
* Restrict f16 immediate store types and simplify scope test
The WGSL spec is restricting f16 in the immediate address space
(gpuweb/gpuweb#6297), so move f16 and vec3h to the rejected immediate
store types and exclude f16 types from the accepted immediate store
types in the shared module-scope coverage.
Simplify the scope test to declare the variable at function scope for
both cases and vary only the address space, using the function address
space as the control. Module-scope validity is already covered by the
module_scope_types test.
* Allow f16 immediate store types per spec
The WGSL spec allows f16 in the immediate address space, so f16 and
vec3h are valid immediate store types and are expected to compile.
No skip is added for implementations that reject f16 immediate data; an
implementation that does so is non-conformant, and these tests flag it.
The render pass, render bundle, and compute pass command switches listed
setImmediates as a parameter but had no matching case. Once an implementation
exposes setImmediates, the feature-presence guard no longer skips and the
command falls through to unreachable().
Add a setImmediates case to each switch that issues a minimal valid call,
keeping the existing feature-presence guards so the cases still skip when the
feature is unavailable.
Issue #4669
* Add test to verify all the valid subgroup sizes work for subgroup size attribute
This patch adds an execution test to verify all the power-of-two values
in [SubgroupMinSize, SubgroupMaxSize] can be used as @subgroup_size
attribute in a simple compute pipeline.
* Address reviewer's comment
* Verify an error occurs when subgroup size is too small or too large
This allows the varying behaviour observed on different platforms.
Generalize the "findFailedPixels" utility to allow two reference
"expected" texel views. A pixel comparison succeeds if the "actual"
texel matches the texel from either of the "expected" or the "alternate
expected" texel views.
See https://github.com/gpuweb/gpuweb/issues/5457
Co-authored-by: alan-baker <alanbaker@google.com>
* Extra WGSL validation for @align
* Cover no value decl usage
* Cover more address spaces
* Cover other types of decls
* reduce parameterizations by adding subcases
* change for review
The existing remainder cases only use moduli 10 and 256 (from the sparse i32 range), missing value-dependent codegen paths such as modulus 768 where some implementations compute signed % as unsigned for negative operands (e.g. -1 % 768 returns 255 instead of -1). Add a remainder_negative test covering negative dividends across moduli 3/7/100/256/768/1000. See https://github.com/gfx-rs/wgpu/issues/8191.
Add CTS tests for the Atomic Vec2u Min/Max extension. These tests were created by @petermcneeleychromium.
The tests have been run and pass on Dawn on Metal.
---------
Co-authored-by: Peter McNeeley <petermcneeley@google.com>
These properties are now exposed on GPUAdapterInfo, so the local
`SubgroupProperties` interface and the `adapterInfo as SubgroupProperties`
casts are no longer needed. Read them directly via
`adapterInfo.subgroupMinSize` / `adapterInfo.subgroupMaxSize`.
They are still declared optional in @webgpu/types (number | undefined),
so a non-null assertion (!) is used at these call sites, which are all
gated on the `subgroups` (or `subgroup-size-control`) feature where the
values are guaranteed to be present.
Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
* Add shared support for WGSL immediate validation
This patch adds the shared CTS plumbing needed by the follow-up
WGSL `immediate` address space validation tests.
It adds `immediate_address_space` to the known WGSL language feature
list, models `immediate` in the address space metadata, and treats it
as a module-scope, unbound, read-only address space with
host-shareable store types.
The validation helpers emit the required WGSL `requires` directive and
skip immediate tests when immediate data is not exposed by the browser.
The skip checks `setImmediates`/`maxImmediateSize` because current
Chrome Canary exposes the API before advertising the WGSL feature.
This also removes two now-unnecessary address-space type assertions
that became redundant once the shared metadata was typed by
`AddressSpace`.
* Apply suggestions from code review
Will remove them when real immediate case added.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Revert "Apply suggestions from code review"
This reverts commit 55434a1ea18b176b33c1a25866938c99282f755c.
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
When the implementation selects a subgroup size < 8 for the test's
workgroup, the split predicate `id < subgroupSize / 2` bisects the
only quad in the subgroup, leaving no fully active quad — which is
undefined behavior for quad operations. This is observed on WARP
(which selects its native D3D12 wave size: 4 on arm64 NEON, often 4
on x86 for small workgroups) and may occur on any implementation
that picks a small native subgroup size at runtime.
Two coordinated guards:
* In the shader, the quad call is wrapped in
`if subgroupSize >= 8u { ... }` so it never executes when the
split predicate would be unsafe.
* In the JS checker, the actual subgroupSize is read out of
metadata.subgroup_size[0] and the test is skipped with t.skip
when it is < 8, so the missing output doesn't get flagged as a
failure.
Querying GPUAdapterInfo.subgroupMinSize would not be sufficient: the
size the implementation actually selects depends on the shader (its
workgroup size, register pressure, etc.), not just the adapter's
minimum supported size. Reading subgroupSize from inside the test
shader itself is the only reliable signal.
* Add shader validation tests on subgroup-size-control - Part II
This patch adds the second part of the shader validation tests on the
extension subgroup-size-control:
- The value of @subgroup_size must be a constant expression or an
override expression that resolves to an i32 or an u32.
- The value of @subgroup_size must be a power of 2.
- The x-dimension of the entry point's workgroup_size must be a
multiple of the @subgroup_size value, or a pipeline creation error
occurs
Issue: #4640
* Address reviewer's comments
* Add shader execution tests on the feature `subgroup-size-control`
This patch adds the shader execution tests on the feature
`subgroup-size-control`:
- The value of the built-in variable `subgroup_size` must equal the
value of the `@subgroup_size` attribute.
- At least one value in the range of [GPUAdapterInfo.subgroupMinSize,
GPUAdapterInfo.subgroupMaxSize] can be used as `@subgroup_size`
attribute in a simple compute pipeline.
* Address reviewer's comments
* Address reviewer's comments
This patch adds the API validation tests on the extension
`subgroup-size-control`:
- Enabling subgroup-size-control on the creation of device should
also enable subgroups.
* Test viewFormats with TRANSIENT_ATTACHMENT
This should not be allowed.
Issue: https://github.com/gpuweb/gpuweb/issues/6263
* also see what happens if we do try to create a view
* fix for compat
* Add shader validation tests on `subgroup-size-control` - Part I
This patch adds the first part of the shader validation tests on
the extension `subgroup-size-control`:
- Enabling `subgroup_size_control` must also enable `subgroups`.
- The WGSL attribute `@subgroup_size` must be used when
`subgroup_size_control` is enabled.
- `@subgroup_size` can only be used in the compute stage
issue: #4640
* Fix comments
* Address reviewer's comments
* Test that createBuffer/createTexture only allows exposed usages
For any buffer/texture usages known by the CTS, check that the browser
only accepts it if it also exposes it.
Currently the buffer test passes in all browsers - there haven't been any
new usages in a long time. But next time we add a usage, this makes sure
that when they start accepting the usage, they also start exposing it.
The texture test fails in Safari because it's missing validation of
unknown texture usages (this is also caught by another new test that
tests an invalid usage). Passes in Chrome/Firefox.
Unrelated cleanup: filter out redundant cases in createBuffer usage tests.
* Apply suggestions from code review
Co-authored-by: François Beaufort <beaufort.francois@gmail.com>
---------
Co-authored-by: François Beaufort <beaufort.francois@gmail.com>
* Test createTexture() with invalid usages or combinations of usages
Per spec, TRANSIENT_ATTACHMENT cannot be used in any combination of
usages other than RENDER_ATTACHMENT | TRANSIENT_ATTACHMENT.
* address comments
This restriction is missing from the spec, but textures with
TRANSIENT_ATTACHMENT must not be used as resolve targets.
This must apply regardless of any usage subsetting in createView(). For
simplicity (to better avoid bugs in validation elsewhere), it's proposed
that createView() simply cannot subset a TRANSIENT_ATTACHMENT texture.
This test implements that proposal.
* Check clearing of 3d textures when rendering to a slice
There was an issue in some browsers where, when rendering
to a slice of a 3d texture, they'd mark the entire texture
as initialized even though only the individual slice was
initialized.
Updated the tests so they check the entire texture.
Also updated them to try every format.
Queries are not allowed to be used more than once in
the same render pass but they are allowed to be used
more than once in the same command buffer, without
resolving inbetween use.
Add a test this works as expected.