@@ -3,16 +3,24 @@ Validation tests for the readonly_and_readwrite_storage_textures language featur
33` ;
44
55import { makeTestGroup } from '../../../../common/framework/test_group.js' ;
6- import { kPossibleStorageTextureFormats } from '../../../format_info.js' ;
6+ import {
7+ kPossibleStorageTextureFormats ,
8+ //kTextureFormatsTier1EnablesStorageReadOnlyWriteOnly,
9+ } from '../../../format_info.js' ;
710import { ShaderValidationTest } from '../shader_validation_test.js' ;
811
912export const g = makeTestGroup ( ShaderValidationTest ) ;
1013
11- const kFeatureName = 'readonly_and_readwrite_storage_textures' ;
14+ const kAccessModeFeatureName = 'readonly_and_readwrite_storage_textures' ;
15+ //const kTier1FeatureName = 'texture_formats_tier1';
1216
1317g . test ( 'var_decl' )
1418 . desc (
15- `Checks that the read and read_write access modes are only allowed with the language feature present`
19+ `Checks that the read and read_write access modes are only allowed with the language feature present
20+
21+ TODO(https://github.com/gpuweb/cts/issues/TBD): Enable the check for
22+ the tier1 language feature.
23+ `
1624 )
1725 . paramsSubcasesOnly ( u =>
1826 u
@@ -28,9 +36,22 @@ g.test('var_decl')
2836 . fn ( t => {
2937 const { type, format, access } = t . params ;
3038
39+ let valid = true ;
40+ if ( access !== 'write' ) {
41+ valid &&= t . hasLanguageFeature ( kAccessModeFeatureName ) ;
42+ }
43+ // Enable this once reporting of the language feature is implemented.
44+ /*
45+ if (kTextureFormatsTier1EnablesStorageReadOnlyWriteOnly.indexOf(format) >= 0) {
46+ // Even though some of these formats do not support read-write access
47+ // without the tier2 adapter feature, their validity in WGSL depends
48+ // only on the language feature for tier1.
49+ valid &&= t.hasLanguageFeature(kTier1FeatureName);
50+ }
51+ */
52+
3153 const source = `@group(0) @binding(0) var t : ${ type } <${ format } , ${ access } >;` ;
32- const requiresFeature = access !== 'write' ;
33- t . expectCompileResult ( t . hasLanguageFeature ( kFeatureName ) || ! requiresFeature , source ) ;
54+ t . expectCompileResult ( valid , source ) ;
3455 } ) ;
3556
3657g . test ( 'textureBarrier' )
@@ -39,7 +60,7 @@ g.test('textureBarrier')
3960 )
4061 . fn ( t => {
4162 t . expectCompileResult (
42- t . hasLanguageFeature ( kFeatureName ) ,
63+ t . hasLanguageFeature ( kAccessModeFeatureName ) ,
4364 `
4465 @workgroup_size(1) @compute fn main() {
4566 textureBarrier();
0 commit comments