Skip to content

Commit

Permalink
WGSL: Add validation tests for readonly_and_readwrite_storage_texture…
Browse files Browse the repository at this point in the history
…s. (gpuweb#3453)
  • Loading branch information
Kangz authored Mar 5, 2024
1 parent 1f4b242 commit 70ac878
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,8 @@
"webgpu:shader,validation,expression,unary,address_of_and_indirection:invalid:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,extension,pointer_composite_access:deref:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,extension,pointer_composite_access:pointer:*": { "subcaseMS": 0.000 },
"webgpu:shader,validation,extension,readonly_and_readwrite_storage_textures:textureBarrier:*": { "subcaseMS": 1.141 },
"webgpu:shader,validation,extension,readonly_and_readwrite_storage_textures:var_decl:*": { "subcaseMS": 42.299 },
"webgpu:shader,validation,functions,alias_analysis:aliasing_inside_function:*": { "subcaseMS": 1.200 },
"webgpu:shader,validation,functions,alias_analysis:member_accessors:*": { "subcaseMS": 1.656 },
"webgpu:shader,validation,functions,alias_analysis:one_atomic_pointer_one_module_scope:*": { "subcaseMS": 0.000 },
Expand Down Expand Up @@ -2194,8 +2196,8 @@
"webgpu:web_platform,copyToTexture,video:copy_from_video:*": { "subcaseMS": 25.101 },
"webgpu:web_platform,external_texture,video:importExternalTexture,compute:*": { "subcaseMS": 36.270 },
"webgpu:web_platform,external_texture,video:importExternalTexture,sample:*": { "subcaseMS": 34.968 },
"webgpu:web_platform,external_texture,video:importExternalTexture,sample_non_YUV_video_frame:*": { "subcaseMS": 36.270 },
"webgpu:web_platform,external_texture,video:importExternalTexture,sampleWithVideoFrameWithVisibleRectParam:*": { "subcaseMS": 29.160 },
"webgpu:web_platform,external_texture,video:importExternalTexture,sample_non_YUV_video_frame:*": { "subcaseMS": 36.270 },
"webgpu:web_platform,worker,worker:dedicated_worker:*": { "subcaseMS": 245.901 },
"webgpu:web_platform,worker,worker:shared_worker:*": { "subcaseMS": 26.801 },
"_end": ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export const description = `
Validation tests for the readonly_and_readwrite_storage_textures language feature
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { TexelFormats } from '../../types.js';
import { ShaderValidationTest } from '../shader_validation_test.js';

export const g = makeTestGroup(ShaderValidationTest);

const kFeatureName = 'readonly_and_readwrite_storage_textures';

g.test('var_decl')
.desc(
`Checks that the read and read_write access modes are only allowed with the language feature present`
)
.paramsSubcasesOnly(u =>
u
.combine('type', [
'texture_storage_1d',
'texture_storage_2d',
'texture_storage_2d_array',
'texture_storage_3d',
])
.combine('format', TexelFormats)
.combine('access', ['read', 'write', 'read_write'])
)
.fn(t => {
const { type, format, access } = t.params;
const source = `@group(0) @binding(0) var t : ${type}<${format.format}, ${access}>;`;
const requiresFeature = access !== 'write';
t.expectCompileResult(t.hasLanguageFeature(kFeatureName) || !requiresFeature, source);
});

g.test('textureBarrier')
.desc(
`Checks that the textureBarrier() builtin is only allowed with the language feature present`
)
.fn(t => {
t.expectCompileResult(
t.hasLanguageFeature(kFeatureName),
`
@workgroup_size(1) @compute fn main() {
textureBarrier();
}
`
);
});

0 comments on commit 70ac878

Please sign in to comment.