summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js')
-rw-r--r--testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js
new file mode 100644
index 0000000000..1059208d45
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/validation/expression/call/builtin/pack2x16snorm.spec.js
@@ -0,0 +1,58 @@
+/**
+* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
+**/const kFn = 'pack2x16snorm';export const description = `Validate ${kFn}`;
+import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
+import { keysOf } from '../../../../../../common/util/data_tables.js';
+import { ShaderValidationTest } from '../../../shader_validation_test.js';
+
+const kArgCases = {
+ good: '(vec2f())',
+ good_vec2_abstract_float: '(vec2(0.1))',
+ bad_0args: '()',
+ bad_2args: '(vec2f(),vec2f())',
+ bad_abstract_int: '(1)',
+ bad_i32: '(1i)',
+ bad_f32: '(1f)',
+ bad_u32: '(1u)',
+ bad_abstract_float: '(0.1)',
+ bad_bool: '(false)',
+ bad_vec4f: '(vec4f())',
+ bad_vec4u: '(vec4u())',
+ bad_vec4i: '(vec4i())',
+ bad_vec4b: '(vec4<bool>())',
+ bad_vec3f: '(vec3f())',
+ bad_array: '(array(1.0, 2.0, 3.0, 4.0))',
+ bad_struct: '(modf(1.1))'
+};
+const kGoodArgs = kArgCases['good'];
+const kReturnType = 'u32';
+
+export const g = makeTestGroup(ShaderValidationTest);
+
+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.expectCompileResult(
+ t.params.arg === 'good' || t.params.arg === 'good_vec2_abstract_float',
+ `const c = ${kFn}${kArgCases[t.params.arg]};`
+ );
+});
+
+g.test('return').
+desc(`Test ${kFn} return value type`).
+params((u) => u.combine('type', ['u32', 'i32', 'f32', 'bool', 'vec2u'])).
+fn((t) => {
+ t.expectCompileResult(
+ t.params.type === kReturnType,
+ `const c: ${t.params.type} = ${kFn}${kGoodArgs};`
+ );
+});
+
+g.test('must_use').
+desc(`Result of ${kFn} must be used`).
+params((u) => u.combine('use', [true, false])).
+fn((t) => {
+ const use_it = t.params.use ? '_ = ' : '';
+ t.expectCompileResult(t.params.use, `fn f() { ${use_it}${kFn}${kGoodArgs}; }`);
+}); \ No newline at end of file