Skip to content

Commit f93e7e2

Browse files
authored
Give case keys names and update json (#4591)
Modify the swizzle assignment tests to give them named cases (to satisfy the name length requirements of cases), and update listing_meta.json for recently added tests that weren't included.
1 parent df0dced commit f93e7e2

2 files changed

Lines changed: 30 additions & 17 deletions

File tree

src/webgpu/listing_meta.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,11 @@
19651965
"webgpu:shader,execution,statement,increment_decrement:vec4_element_decrement:*": { "subcaseMS": 5.300 },
19661966
"webgpu:shader,execution,statement,increment_decrement:vec4_element_increment:*": { "subcaseMS": 6.300 },
19671967
"webgpu:shader,execution,statement,phony:executes:*": { "subcaseMS": 129.949 },
1968+
"webgpu:shader,execution,statement,swizzle_assignment:swizzle_assignment_chained:*": { "subcaseMS": 0.112 },
1969+
"webgpu:shader,execution,statement,swizzle_assignment:swizzle_assignment_local_var:*": { "subcaseMS": 286.932 },
1970+
"webgpu:shader,execution,statement,swizzle_assignment:swizzle_assignment_other_vars:*": { "subcaseMS": 0.140 },
1971+
"webgpu:shader,execution,statement,swizzle_assignment:swizzle_assignment_pointer:*": { "subcaseMS": 0.109 },
1972+
"webgpu:shader,execution,statement,swizzle_assignment:swizzle_compound_assignment:*": { "subcaseMS": 0.091 },
19681973
"webgpu:shader,execution,value_init:array,nested:*": { "subcaseMS": 3004.523 },
19691974
"webgpu:shader,execution,value_init:array:*": { "subcaseMS": 3831.989 },
19701975
"webgpu:shader,execution,value_init:mat:*": { "subcaseMS": 703.612 },
@@ -2877,6 +2882,12 @@
28772882
"webgpu:shader,validation,statement,switch:condition_type:*": { "subcaseMS": 5.402 },
28782883
"webgpu:shader,validation,statement,switch:condition_type_match_case_type:*": { "subcaseMS": 3.750 },
28792884
"webgpu:shader,validation,statement,switch:parse:*": { "subcaseMS": 16.068 },
2885+
"webgpu:shader,validation,statement,swizzle_assignment:invalid_component_mismatch:*": { "subcaseMS": 1.246 },
2886+
"webgpu:shader,validation,statement,swizzle_assignment:invalid_component_oob:*": { "subcaseMS": 1.297 },
2887+
"webgpu:shader,validation,statement,swizzle_assignment:invalid_duplicate_components:*": { "subcaseMS": 1.005 },
2888+
"webgpu:shader,validation,statement,swizzle_assignment:invalid_lhs_not_reference:*": { "subcaseMS": 3.222 },
2889+
"webgpu:shader,validation,statement,swizzle_assignment:invalid_type_mismatch:*": { "subcaseMS": 1.086 },
2890+
"webgpu:shader,validation,statement,swizzle_assignment:valid:*": { "subcaseMS": 138.201 },
28802891
"webgpu:shader,validation,statement,while:condition_type:*": { "subcaseMS": 5.328 },
28812892
"webgpu:shader,validation,statement,while:parse:*": { "subcaseMS": 8.641 },
28822893
"webgpu:shader,validation,types,alias:any_type:*": { "subcaseMS": 42.329 },

src/webgpu/shader/execution/statement/swizzle_assignment.spec.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Swizzle assignment execution.
33
`;
44

55
import { makeTestGroup } from '../../../../common/framework/test_group.js';
6+
import { keysOf } from '../../../../common/util/data_tables.js';
67
import { TypedArrayBufferView } from '../../../../common/util/util.js';
78
import { Float16Array } from '../../../../external/petamoriken/float16/float16.js';
89
import { AllFeaturesMaxLimitsGPUTest, GPUTest } from '../../../gpu_test.js';
@@ -119,10 +120,10 @@ interface SwizzleAssignmentCase {
119120
expected: readonly number[];
120121
}
121122

122-
const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
123+
const kSwizzleAssignmentCases: Record<string, SwizzleAssignmentCase> = {
123124
// v = vec4u(1, 2, 3, 4)
124125
// v.w = 5;
125-
{
126+
vec4u_w_literal: {
126127
elemType: 'u32',
127128
vecSize: 4,
128129
initial: [1, 2, 3, 4],
@@ -132,7 +133,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
132133
},
133134
// v = vec4u(1, 2, 3, 5)
134135
// v.xy = vec2u(6, 7);
135-
{
136+
vec4u_xy_vec2u: {
136137
elemType: 'u32',
137138
vecSize: 4,
138139
initial: [1, 2, 3, 5],
@@ -142,7 +143,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
142143
},
143144
// v = vec4u(6, 7, 3, 5)
144145
// v.zx = vec2u(8, 9);
145-
{
146+
vec4u_zx_vec2u: {
146147
elemType: 'u32',
147148
vecSize: 4,
148149
initial: [6, 7, 3, 5],
@@ -152,7 +153,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
152153
},
153154
// v = vec4u(1, 1, 1, 1)
154155
// v.xyzw = vec4u(10, 11, 12, 13);
155-
{
156+
vec4u_xyzw_vec4u: {
156157
elemType: 'u32',
157158
vecSize: 4,
158159
initial: [1, 1, 1, 1],
@@ -162,7 +163,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
162163
},
163164
// v = vec4u(10, 11, 12, 13)
164165
// v.xy = vec2(v.y, v.x);
165-
{
166+
vec4u_xy_vec2_yx: {
166167
elemType: 'u32',
167168
vecSize: 4,
168169
initial: [10, 11, 12, 13],
@@ -172,7 +173,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
172173
},
173174
// v = vec3i(-10, -20, -30)
174175
// v.y = 50;
175-
{
176+
vec3i_y_literal: {
176177
elemType: 'i32',
177178
vecSize: 3,
178179
initial: [-10, -20, -30],
@@ -182,7 +183,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
182183
},
183184
// v = vec3i(10, 20, 30)
184185
// v.zx = vec2i(40, 60);
185-
{
186+
vec3i_zx_vec2i: {
186187
elemType: 'i32',
187188
vecSize: 3,
188189
initial: [10, 20, 30],
@@ -192,7 +193,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
192193
},
193194
// v = vec3f(1.0, 2.0, 3.0)
194195
// v.xy = vec2f(4.0, 5.0);
195-
{
196+
vec3f_xy_vec2f: {
196197
elemType: 'f32',
197198
vecSize: 3,
198199
initial: [1.0, 2.0, 3.0],
@@ -202,7 +203,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
202203
},
203204
// v = vec2f(1.0, 2.0)
204205
// v.xy = v + v;
205-
{
206+
vec2f_yx_v_plus_v: {
206207
elemType: 'f32',
207208
vecSize: 2,
208209
initial: [1.0, 2.0],
@@ -212,7 +213,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
212213
},
213214
// v = vec4f(10.0, 20.0, 30.0, 100.0)
214215
// v.rgb = vec3f(v.r, v.g, v.b) / 10;
215-
{
216+
vec4f_rgb_vec3f_div_10: {
216217
elemType: 'f32',
217218
vecSize: 4,
218219
initial: [10.0, 20.0, 30.0, 100.0],
@@ -222,7 +223,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
222223
},
223224
// v = vec2h(1.0, 2.0)
224225
// v.yx = vec2h(4.0, 5.0);
225-
{
226+
vec2h_yx_vec2h: {
226227
elemType: 'f16',
227228
vecSize: 2,
228229
initial: [1.0, 2.0],
@@ -232,7 +233,7 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
232233
},
233234
// v = vec2<bool>(true, false)
234235
// v.y = true;
235-
{
236+
vec2_bool_y_true: {
236237
elemType: 'bool',
237238
vecSize: 2,
238239
initial: [1, 0],
@@ -242,21 +243,22 @@ const kSwizzleAssignmentCases: SwizzleAssignmentCase[] = [
242243
},
243244
// v = vec3<bool>(true, true, true)
244245
// v.xz = vec2<bool>(false, false);
245-
{
246+
vec3_bool_xz_vec2bool: {
246247
elemType: 'bool',
247248
vecSize: 3,
248249
initial: [1, 1, 1],
249250
swizzle: 'xz',
250251
rhs: 'vec2<bool>(false, false)',
251252
expected: [0, 1, 0],
252253
},
253-
];
254+
};
254255

255256
g.test('swizzle_assignment_local_var')
256257
.desc('Tests the value of a vector after swizzle assignment on a local function variable.')
257-
.params(u => u.combine('case', kSwizzleAssignmentCases))
258+
.params(u => u.combine('case', keysOf(kSwizzleAssignmentCases)))
258259
.fn(t => {
259-
const { elemType, vecSize, initial, swizzle, rhs, expected } = t.params.case;
260+
const { elemType, vecSize, initial, swizzle, rhs, expected } =
261+
kSwizzleAssignmentCases[t.params.case];
260262
runSwizzleAssignmentTest(t, elemType, vecSize, initial, swizzle, rhs, expected);
261263
});
262264

0 commit comments

Comments
 (0)