// Global variable & constant declarations const Foo: bool = true; var wg : array; var at: atomic; struct FooStruct { v3: vec3, // test packed vec3 v1: f32, } @group(0) @binding(1) var alignment: FooStruct; @group(0) @binding(2) var dummy: array>; @group(0) @binding(3) var float_vecs: array, 20>; @group(0) @binding(4) var global_vec: vec3; @group(0) @binding(5) var global_mat: mat3x2; @group(0) @binding(6) var global_nested_arrays_of_matrices_2x4: array, 2>, 2>; @group(0) @binding(7) var global_nested_arrays_of_matrices_4x2: array, 2>, 2>; fn test_msl_packed_vec3_as_arg(arg: vec3) {} fn test_msl_packed_vec3() { // stores alignment.v3 = vec3(1.0); var idx = 1; alignment.v3.x = 1.0; alignment.v3[0] = 2.0; alignment.v3[idx] = 3.0; // force load to happen here let data = alignment; // loads let l0 = data.v3; let l1 = data.v3.zx; test_msl_packed_vec3_as_arg(data.v3); // matrix vector multiplication let mvm0 = data.v3 * mat3x3(); let mvm1 = mat3x3() * data.v3; // scalar vector multiplication let svm0 = data.v3 * 2.0; let svm1 = 2.0 * data.v3; } @compute @workgroup_size(1) fn main() { test_msl_packed_vec3(); wg[7] = (global_nested_arrays_of_matrices_4x2[0][0] * global_nested_arrays_of_matrices_2x4[0][0][0]).x; wg[6] = (global_mat * global_vec).x; wg[5] = dummy[1].y; wg[4] = float_vecs[0].w; wg[3] = alignment.v1; wg[2] = alignment.v3.x; alignment.v1 = 4.0; wg[1] = f32(arrayLength(&dummy)); atomicStore(&at, 2u); // Valid, Foo and at is in function scope var Foo: f32 = 1.0; var at: bool = true; }