diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index 0698bad96bd4..2df3f2a36222 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -1875,11 +1875,11 @@ "webgpu:shader,validation,expression,call,builtin,degrees:values:*": { "subcaseMS": 0.303 }, "webgpu:shader,validation,expression,call,builtin,derivatives:invalid_argument_types:*": { "subcaseMS": 1.000 }, "webgpu:shader,validation,expression,call,builtin,derivatives:only_in_fragment:*": { "subcaseMS": 1.000 }, - "webgpu:shader,validation,expression,call,builtin,dot4I8Packed:bad_args:*": { "subcaseMS": 0.302 }, + "webgpu:shader,validation,expression,call,builtin,dot4I8Packed:args:*": { "subcaseMS": 48.785 }, "webgpu:shader,validation,expression,call,builtin,dot4I8Packed:must_use:*": { "subcaseMS": 0.300 }, "webgpu:shader,validation,expression,call,builtin,dot4I8Packed:supported:*": { "subcaseMS": 1.100 }, "webgpu:shader,validation,expression,call,builtin,dot4I8Packed:unsupported:*": { "subcaseMS": 7.250 }, - "webgpu:shader,validation,expression,call,builtin,dot4U8Packed:bad_args:*": { "subcaseMS": 0.401 }, + "webgpu:shader,validation,expression,call,builtin,dot4U8Packed:args:*": { "subcaseMS": 45.347 }, "webgpu:shader,validation,expression,call,builtin,dot4U8Packed:must_use:*": { "subcaseMS": 0.100 }, "webgpu:shader,validation,expression,call,builtin,dot4U8Packed:supported:*": { "subcaseMS": 0.401 }, "webgpu:shader,validation,expression,call,builtin,dot4U8Packed:unsupported:*": { "subcaseMS": 3.200 }, @@ -1887,7 +1887,7 @@ "webgpu:shader,validation,expression,call,builtin,exp2:values:*": { "subcaseMS": 0.410 }, "webgpu:shader,validation,expression,call,builtin,exp:integer_argument:*": { "subcaseMS": 1.356 }, "webgpu:shader,validation,expression,call,builtin,exp:values:*": { "subcaseMS": 0.311 }, - "webgpu:shader,validation,expression,call,builtin,floor:bad_args:*": { "subcaseMS": 14.467 }, + "webgpu:shader,validation,expression,call,builtin,floor:args:*": { "subcaseMS": 4.221 }, "webgpu:shader,validation,expression,call,builtin,floor:integer_argument:*": { "subcaseMS": 48.400 }, "webgpu:shader,validation,expression,call,builtin,floor:must_use:*": { "subcaseMS": 0.170 }, "webgpu:shader,validation,expression,call,builtin,floor:values:*": { "subcaseMS": 29.668 }, @@ -1908,19 +1908,19 @@ "webgpu:shader,validation,expression,call,builtin,log:values:*": { "subcaseMS": 0.291 }, "webgpu:shader,validation,expression,call,builtin,modf:integer_argument:*": { "subcaseMS": 1.089 }, "webgpu:shader,validation,expression,call,builtin,modf:values:*": { "subcaseMS": 1.866 }, - "webgpu:shader,validation,expression,call,builtin,pack4xI8:bad_args:*": { "subcaseMS": 40.750 }, + "webgpu:shader,validation,expression,call,builtin,pack4xI8:args:*": { "subcaseMS": 36.226 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8:must_use:*": { "subcaseMS": 6.500 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8:supported:*": { "subcaseMS": 113.501 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8:unsupported:*": { "subcaseMS": 739.400 }, - "webgpu:shader,validation,expression,call,builtin,pack4xI8Clamp:bad_args:*": { "subcaseMS": 39.240 }, + "webgpu:shader,validation,expression,call,builtin,pack4xI8Clamp:args:*": { "subcaseMS": 21.994 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8Clamp:must_use:*": { "subcaseMS": 34.301 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8Clamp:supported:*": { "subcaseMS": 100.450 }, "webgpu:shader,validation,expression,call,builtin,pack4xI8Clamp:unsupported:*": { "subcaseMS": 751.101 }, - "webgpu:shader,validation,expression,call,builtin,pack4xU8:bad_args:*": { "subcaseMS": 37.770 }, + "webgpu:shader,validation,expression,call,builtin,pack4xU8:args:*": { "subcaseMS": 24.783 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8:must_use:*": { "subcaseMS": 5.300 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8:supported:*": { "subcaseMS": 449.800 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8:unsupported:*": { "subcaseMS": 773.702 }, - "webgpu:shader,validation,expression,call,builtin,pack4xU8Clamp:bad_args:*": { "subcaseMS": 124.860 }, + "webgpu:shader,validation,expression,call,builtin,pack4xU8Clamp:args:*": { "subcaseMS": 26.118 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8Clamp:must_use:*": { "subcaseMS": 32.600 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8Clamp:supported:*": { "subcaseMS": 134.750 }, "webgpu:shader,validation,expression,call,builtin,pack4xU8Clamp:unsupported:*": { "subcaseMS": 570.500 }, @@ -1959,11 +1959,11 @@ "webgpu:shader,validation,expression,call,builtin,textureSampleGrad:ddY_argument:*": { "subcaseMS": 1.515 }, "webgpu:shader,validation,expression,call,builtin,textureSampleGrad:offset_argument,non_const:*": { "subcaseMS": 1.987 }, "webgpu:shader,validation,expression,call,builtin,textureSampleGrad:offset_argument:*": { "subcaseMS": 1.317 }, - "webgpu:shader,validation,expression,call,builtin,unpack4xI8:bad_args:*": { "subcaseMS": 121.263 }, + "webgpu:shader,validation,expression,call,builtin,unpack4xI8:args:*": { "subcaseMS": 23.923 }, "webgpu:shader,validation,expression,call,builtin,unpack4xI8:must_use:*": { "subcaseMS": 35.200 }, "webgpu:shader,validation,expression,call,builtin,unpack4xI8:supported:*": { "subcaseMS": 24.150 }, "webgpu:shader,validation,expression,call,builtin,unpack4xI8:unsupported:*": { "subcaseMS": 615.301 }, - "webgpu:shader,validation,expression,call,builtin,unpack4xU8:bad_args:*": { "subcaseMS": 40.113 }, + "webgpu:shader,validation,expression,call,builtin,unpack4xU8:args:*": { "subcaseMS": 21.830 }, "webgpu:shader,validation,expression,call,builtin,unpack4xU8:must_use:*": { "subcaseMS": 32.800 }, "webgpu:shader,validation,expression,call,builtin,unpack4xU8:supported:*": { "subcaseMS": 98.501 }, "webgpu:shader,validation,expression,call,builtin,unpack4xU8:unsupported:*": { "subcaseMS": 346.801 }, diff --git a/src/webgpu/shader/validation/expression/call/builtin/dot4I8Packed.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/dot4I8Packed.spec.ts index 56c5cf5403eb..c079e08cb159 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/dot4I8Packed.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/dot4I8Packed.spec.ts @@ -6,22 +6,25 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'dot4I8Packed'; -const kGoodArgs = '(1u,2u)'; -const kBadArgs = { - '0args': '()', - '1args': '(1u)', - '3args': '(1u,2u,3u)', - '0i32': '(1i,2u)', - '0f32': '(1f,2u)', - '0bool': '(false,2u)', - '0vec2u': '(vec2u(),2u)', - '1i32': '(1u,2i)', - '1f32': '(1u,2f)', - '1bool': '(1u,true)', - '1vec2u': '(1u,vec2u())', - bool_bool: '(false,true)', - bool2_bool2: '(vec2(),vec2(false,true))', +const kArgCases = { + good: '(1u,2u)', + bad_0args: '()', + bad_1args: '(1u)', + bad_3args: '(1u,2u,3u)', + bad_0i32: '(1i,2u)', + bad_0f32: '(1f,2u)', + bad_0bool: '(false,2u)', + bad_0vec2u: '(vec2u(),2u)', + bad_1i32: '(1u,2i)', + bad_1f32: '(1u,2f)', + bad_1bool: '(1u,true)', + bad_1vec2u: '(1u,vec2u())', + bad_bool_bool: '(false,true)', + bad_bool2_bool2: '(vec2(),vec2(false,true))', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -45,17 +48,19 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/dot4U8Packed.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/dot4U8Packed.spec.ts index 1d240af5a81b..bd9356777ef0 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/dot4U8Packed.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/dot4U8Packed.spec.ts @@ -6,22 +6,25 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'dot4U8Packed'; -const kGoodArgs = '(1u,2u)'; -const kBadArgs = { - '0args': '()', - '1args': '(1u)', - '3args': '(1u,2u,3u)', - '0i32': '(1i,2u)', - '0f32': '(1f,2u)', - '0bool': '(false,2u)', - '0vec2u': '(vec2u(),2u)', - '1i32': '(1u,2i)', - '1f32': '(1u,2f)', - '1bool': '(1u,true)', - '1vec2u': '(1u,vec2u())', - bool_bool: '(false,true)', - bool2_bool2: '(vec2(),vec2(false,true))', +const kArgCases = { + good: '(1u,2u)', + bad_0args: '()', + bad_1args: '(1u)', + bad_3args: '(1u,2u,3u)', + bad_0i32: '(1i,2u)', + bad_0f32: '(1f,2u)', + bad_0bool: '(false,2u)', + bad_0vec2u: '(vec2u(),2u)', + bad_1i32: '(1u,2i)', + bad_1f32: '(1u,2f)', + bad_1bool: '(1u,true)', + bad_1vec2u: '(1u,vec2u())', + bad_bool_bool: '(false,true)', + bad_bool2_bool2: '(vec2(),vec2(false,true))', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -45,17 +48,19 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts index e43c6fa3fe43..ca699c6414d4 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/floor.spec.ts @@ -74,31 +74,35 @@ Validates that scalar and vector integer arguments are rejected by ${builtin}() ); }); -const kGoodArgs = '(1.1)'; -const kBadArgs = { - no_parens: '', +const kArgCases = { + good: '(1.1)', + bad_no_parens: '', // Bad number of args - '0args': '()', - '2args': '(1.0,2.0)', - // Bad value for arg 0 - '0aint': '(1)', - '0i32': '(1i)', - '0u32': '(1u)', - '0bool': '(false)', - '0vec2u': '(vec2u())', - '0array': '(array(1.1,2.2))', - '0struct': '(modf(2.2))', + bad_0args: '()', + bad_2args: '(1.0,2.0)', + // Bad value type for arg 0 + bad_0i32: '(1i)', + bad_0u32: '(1u)', + bad_0bool: '(false)', + bad_0vec2u: '(vec2u())', + bad_0array: '(array(1.1,2.2))', + bad_0struct: '(modf(2.2))', }; -g.test('bad_args') - .desc(`Test compilation failure of ${builtin} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${builtin} with variously shaped and typed arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { - t.expectCompileResult(false, `const c = ${builtin}${kBadArgs[t.params.arg]};`); + t.expectCompileResult( + t.params.arg === 'good', + `const c = ${builtin}${kArgCases[t.params.arg]};` + ); }); g.test('must_use') .desc(`Result of ${builtin} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { - t.expectCompileResult(false, `fn f() { ${builtin}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${builtin}${kArgCases['good']}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/pack4xI8.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/pack4xI8.spec.ts index a53dbc863b78..21b7b706cfec 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/pack4xI8.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/pack4xI8.spec.ts @@ -6,19 +6,22 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'pack4xI8'; -const kGoodArgs = '(vec4i())'; -const kBadArgs = { - '0args': '()', - '2args': '(vec4i(),vec4i())', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec4u': '(vec4u())', - '0vec4f': '(vec4f())', - '0vec4b': '(vec4())', - '0vec2i': '(vec2i())', - '0vec3i': '(vec3i())', +const kArgCases = { + good: '(vec4i())', + bad_0args: '()', + bad_2args: '(vec4i(),vec4i())', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec4u: '(vec4u())', + bad_0vec4f: '(vec4f())', + bad_0vec4b: '(vec4())', + bad_0vec2i: '(vec2i())', + bad_0vec3i: '(vec3i())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -42,17 +45,18 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { - t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/pack4xI8Clamp.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/pack4xI8Clamp.spec.ts index 3d34d56fae66..7af8958bb104 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/pack4xI8Clamp.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/pack4xI8Clamp.spec.ts @@ -6,19 +6,22 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'pack4xI8Clamp'; -const kGoodArgs = '(vec4i())'; -const kBadArgs = { - '0args': '()', - '2args': '(vec4i(),vec4i())', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec4u': '(vec4u())', - '0vec4f': '(vec4f())', - '0vec4b': '(vec4())', - '0vec2i': '(vec2i())', - '0vec3i': '(vec3i())', +const kArgCases = { + good: '(vec4i())', + bad_0args: '()', + bad_2args: '(vec4i(),vec4i())', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec4u: '(vec4u())', + bad_0vec4f: '(vec4f())', + bad_0vec4b: '(vec4())', + bad_0vec2i: '(vec2i())', + bad_0vec3i: '(vec3i())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -42,17 +45,18 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { - t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/pack4xU8.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/pack4xU8.spec.ts index ab69c317142c..89daf34f8479 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/pack4xU8.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/pack4xU8.spec.ts @@ -6,19 +6,22 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'pack4xU8'; -const kGoodArgs = '(vec4u())'; -const kBadArgs = { - '0args': '()', - '2args': '(vec4u(),vec4u())', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec4i': '(vec4i())', - '0vec4f': '(vec4f())', - '0vec4b': '(vec4())', - '0vec2u': '(vec2u())', - '0vec3u': '(vec3u())', +const kArgCases = { + good: '(vec4u())', + bad_0args: '()', + bad_2args: '(vec4u(),vec4u())', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec4i: '(vec4i())', + bad_0vec4f: '(vec4f())', + bad_0vec4b: '(vec4())', + bad_0vec2u: '(vec2u())', + bad_0vec3u: '(vec3u())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -42,17 +45,18 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { - t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/pack4xU8Clamp.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/pack4xU8Clamp.spec.ts index 69a3b85ec127..9d7bd0353b4c 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/pack4xU8Clamp.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/pack4xU8Clamp.spec.ts @@ -6,19 +6,22 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'pack4xU8Clamp'; -const kGoodArgs = '(vec4u())'; -const kBadArgs = { - '0args': '()', - '2args': '(vec4u(),vec4u())', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec4i': '(vec4i())', - '0vec4f': '(vec4f())', - '0vec4b': '(vec4())', - '0vec2u': '(vec2u())', - '0vec3u': '(vec3u())', +const kArgCases = { + good: '(vec4u())', + bad_0args: '()', + bad_2args: '(vec4u(),vec4u())', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec4i: '(vec4i())', + bad_0vec4f: '(vec4f())', + bad_0vec4b: '(vec4())', + bad_0vec2u: '(vec2u())', + bad_0vec3u: '(vec3u())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -42,17 +45,18 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { - t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/unpack4xI8.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/unpack4xI8.spec.ts index da735a7f7e93..9736818b719a 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/unpack4xI8.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/unpack4xI8.spec.ts @@ -6,17 +6,20 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'unpack4xI8'; -const kGoodArgs = '(1u)'; -const kBadArgs = { - '0args': '()', - '2args': '(1u,2u)', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec2u': '(vec2u())', - '0vec3u': '(vec3u())', - '0vec4u': '(vec4u())', +const kArgCases = { + good: '(1u)', + bad_0args: '()', + bad_2args: '(1u,2u)', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec2u: '(vec2u())', + bad_0vec3u: '(vec3u())', + bad_0vec4u: '(vec4u())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -40,17 +43,19 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); }); diff --git a/src/webgpu/shader/validation/expression/call/builtin/unpack4xU8.spec.ts b/src/webgpu/shader/validation/expression/call/builtin/unpack4xU8.spec.ts index 24ebc60d9f6c..34b96a461575 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/unpack4xU8.spec.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/unpack4xU8.spec.ts @@ -6,17 +6,20 @@ import { ShaderValidationTest } from '../../../shader_validation_test.js'; const kFeature = 'packed_4x8_integer_dot_product'; const kFn = 'unpack4xU8'; -const kGoodArgs = '(1u)'; -const kBadArgs = { - '0args': '()', - '2args': '(1u,2u)', - '0i32': '(1i)', - '0f32': '(1f)', - '0bool': '(false)', - '0vec2u': '(vec2u())', - '0vec3u': '(vec3u())', - '0vec4u': '(vec4u())', +const kArgCases = { + good: '(1u)', + bad_0args: '()', + bad_2args: '(1u,2u)', + bad_0i32: '(1i)', + bad_0f32: '(1f)', + bad_0bool: '(false)', + bad_0vec2u: '(vec2u())', + bad_0vec3u: '(vec3u())', + bad_0vec4u: '(vec4u())', + bad_0array: '(array(1))', + bad_0struct: '(modf(1.1))', }; +const kGoodArgs = kArgCases['good']; export const g = makeTestGroup(ShaderValidationTest); @@ -40,17 +43,19 @@ g.test('supported') t.expectCompileResult(true, code); }); -g.test('bad_args') - .desc(`Test compilation failure of ${kFn} with bad arguments`) - .params(u => u.combine('arg', keysOf(kBadArgs))) +g.test('args') + .desc(`Test compilation failure of ${kFn} with various numbers of and types of arguments`) + .params(u => u.combine('arg', keysOf(kArgCases))) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `const c = ${kFn}${kBadArgs[t.params.arg]};`); + t.expectCompileResult(t.params.arg === 'good', `const c = ${kFn}${kArgCases[t.params.arg]};`); }); g.test('must_use') .desc(`Result of ${kFn} must be used`) + .params(u => u.combine('use', [true, false])) .fn(t => { t.skipIfLanguageFeatureNotSupported(kFeature); - t.expectCompileResult(false, `fn f() { ${kFn}${kGoodArgs}; }`); + const use_it = t.params.use ? '_ = ' : ''; + t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`); });