59 lines
1.1 KiB
WebGPU Shading Language
59 lines
1.1 KiB
WebGPU Shading Language
alias Arr = array<u32, 10u>;
|
|
|
|
struct S_atomic {
|
|
/* @offset(0) */
|
|
x : i32,
|
|
/* @offset(4) */
|
|
a : array<atomic<u32>, 10u>,
|
|
/* @offset(44) */
|
|
y : u32,
|
|
}
|
|
|
|
struct S {
|
|
/* @offset(0) */
|
|
x : i32,
|
|
/* @offset(4) */
|
|
a : Arr,
|
|
/* @offset(44) */
|
|
y : u32,
|
|
}
|
|
|
|
var<private> local_invocation_index_1 : u32;
|
|
|
|
var<workgroup> wg : S_atomic;
|
|
|
|
fn compute_main_inner(local_invocation_index : u32) {
|
|
var idx : u32 = 0u;
|
|
wg.x = 0i;
|
|
wg.y = 0u;
|
|
idx = local_invocation_index;
|
|
loop {
|
|
let x_30 : u32 = idx;
|
|
if (!((x_30 < 10u))) {
|
|
break;
|
|
}
|
|
let x_35 : u32 = idx;
|
|
atomicStore(&(wg.a[x_35]), 0u);
|
|
|
|
continuing {
|
|
let x_41 : u32 = idx;
|
|
idx = (x_41 + 1u);
|
|
}
|
|
}
|
|
workgroupBarrier();
|
|
atomicStore(&(wg.a[4i]), 1u);
|
|
return;
|
|
}
|
|
|
|
fn compute_main_1() {
|
|
let x_53 : u32 = local_invocation_index_1;
|
|
compute_main_inner(x_53);
|
|
return;
|
|
}
|
|
|
|
@compute @workgroup_size(1i, 1i, 1i)
|
|
fn compute_main(@builtin(local_invocation_index) local_invocation_index_1_param : u32) {
|
|
local_invocation_index_1 = local_invocation_index_1_param;
|
|
compute_main_1();
|
|
}
|