Skip to content

Commit

Permalink
Add shader pointer parameter tests, including for `unrestricted_point…
Browse files Browse the repository at this point in the history
…er_parameter` support (gpuweb#3265)

* Rename `requireLanguageFeatureOrSkipTestCase`

To `skipIfLanguageFeatureSupported` to match all the other skip methods.

* [shader] Add pointer parameter execution tests

Checks reading and writing to pointer parameters, with and without the 'unrestricted_pointer_parameters' WGSL feature

* [shader] Update function validation tests for UPP

Update the `webgpu:shader,validation,functions,restrictions` tests to handle the `unrestricted_pointer_parameters` WGSL feature
  • Loading branch information
ben-clayton authored Jan 12, 2024
1 parent f43af0c commit 705abe5
Show file tree
Hide file tree
Showing 14 changed files with 872 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ g.test('unused_bindings_in_pipeline')
callDrawOrDispatch,
} = t.params;
if (writableUsage === 'readwrite-storage-texture') {
t.requireLanguageFeatureOrSkipTestCase('readonly_and_readwrite_storage_textures');
t.skipIfLanguageFeatureNotSupported('readonly_and_readwrite_storage_textures');
}

const view = t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ g.test('subresources,set_unused_bind_group')
textureUsage0 === 'readwrite-storage-texture' ||
textureUsage1 === 'readwrite-storage-texture'
) {
t.requireLanguageFeatureOrSkipTestCase('readonly_and_readwrite_storage_textures');
t.skipIfLanguageFeatureNotSupported('readonly_and_readwrite_storage_textures');
}

const texture0 = t.device.createTexture({
Expand Down
14 changes: 9 additions & 5 deletions src/webgpu/gpu_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,21 +459,25 @@ export class GPUTestBase extends Fixture<GPUTestSubcaseBatchState> {
}

/** Skips this test case if the `langFeature` is *not* supported. */
requireLanguageFeatureOrSkipTestCase(langFeature: WGSLLanguageFeature) {
const lf = getGPU(this.rec).wgslLanguageFeatures;
if (lf === undefined || !lf.has(langFeature)) {
skipIfLanguageFeatureNotSupported(langFeature: WGSLLanguageFeature) {
if (!this.hasLanguageFeature(langFeature)) {
this.skip(`WGSL language feature '${langFeature}' is not supported`);
}
}

/** Skips this test case if the `langFeature` is supported. */
skipIfLanguageFeatureSupported(langFeature: WGSLLanguageFeature) {
const lf = getGPU(this.rec).wgslLanguageFeatures;
if (lf !== undefined && lf.has(langFeature)) {
if (this.hasLanguageFeature(langFeature)) {
this.skip(`WGSL language feature '${langFeature}' is supported`);
}
}

/** returns true iff the `langFeature` is supported */
hasLanguageFeature(langFeature: WGSLLanguageFeature) {
const lf = getGPU(this.rec).wgslLanguageFeatures;
return lf !== undefined && lf.has(langFeature);
}

/**
* Expect a GPUBuffer's contents to pass the provided check.
*
Expand Down
7 changes: 7 additions & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,13 @@
"webgpu:shader,validation,expression,call,builtin,unpack4xI8:unsupported:*": { "subcaseMS": 0.351 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:bad_args:*": { "subcaseMS": 0.100 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:must_use:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:read_full_object:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:read_ptr_to_member:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:read_ptr_to_element:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:write_full_object:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:write_ptr_to_member:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:write_ptr_to_element:*": { "subcaseMS": 0.000 },
"webgpu:shader,execution,expression,call,user,ptr_params:mixed_ptr_parameters:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:supported:*": { "subcaseMS": 0.100 },
"webgpu:shader,validation,expression,call,builtin,unpack4xU8:unsupported:*": { "subcaseMS": 0.301 },
"webgpu:shader,validation,functions,alias_analysis:aliasing_inside_function:*": { "subcaseMS": 1.200 },
Expand Down
Loading

0 comments on commit 705abe5

Please sign in to comment.