mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
Use the local (not global) invocation id to decide which invocation should do the initialization, so that every workgroup gets initialized, not just the first.
57 lines
958 B
GLSL
57 lines
958 B
GLSL
#version 310 es
|
|
|
|
precision highp float;
|
|
precision highp int;
|
|
|
|
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
|
|
struct GlobalConst {
|
|
uint a;
|
|
uvec3 b;
|
|
int c;
|
|
};
|
|
struct AlignedWrapper {
|
|
int value;
|
|
};
|
|
struct Baz {
|
|
mat3x2 m;
|
|
};
|
|
struct MatCx2InArray {
|
|
mat4x2 am[2];
|
|
};
|
|
shared uint val;
|
|
|
|
|
|
float read_from_private(inout float foo_1) {
|
|
float _e1 = foo_1;
|
|
return _e1;
|
|
}
|
|
|
|
float test_arr_as_arg(float a[5][10]) {
|
|
return a[4][9];
|
|
}
|
|
|
|
void assign_through_ptr_fn(inout uint p) {
|
|
p = 42u;
|
|
return;
|
|
}
|
|
|
|
void assign_array_through_ptr_fn(inout vec4 foo_2[2]) {
|
|
foo_2 = vec4[2](vec4(1.0), vec4(2.0));
|
|
return;
|
|
}
|
|
|
|
void main() {
|
|
if (gl_LocalInvocationID == uvec3(0u)) {
|
|
val = 0u;
|
|
}
|
|
memoryBarrierShared();
|
|
barrier();
|
|
vec4 arr[2] = vec4[2](vec4(0.0), vec4(0.0));
|
|
arr = vec4[2](vec4(6.0), vec4(7.0));
|
|
assign_through_ptr_fn(val);
|
|
assign_array_through_ptr_fn(arr);
|
|
return;
|
|
}
|
|
|