1void main() {
2 const uint i = gl_GlobalInvocationID.z * 262144 + gl_GlobalInvocationID.y * 512 + gl_GlobalInvocationID.x;
3
4 if (i >= p.N) {
5 return;
6 }
7
8 const uint row = i / p.ne20;
9 const uint col = i - row * p.ne20;
10
11 if (p.mode == 0) {
12 // Default
13 const uint offset = p.ne00 / 2;
14 const uint idx = row * p.ne00 + col;
15
16 data_d[row * offset + col] = D_TYPE(op(float(data_a[idx]), float(data_a[idx + offset])));
17 } else if (p.mode == 1) {
18 // Swapped
19 const uint offset = p.ne00 / 2;
20 const uint idx = row * p.ne00 + col;
21
22 data_d[row * offset + col] = D_TYPE(op(float(data_a[idx + offset]), float(data_a[idx])));
23 } else {
24 // Split
25 const uint idx = row * p.ne00 + col;
26
27 data_d[idx] = D_TYPE(op(float(data_a[idx]), float(data_b[idx])));
28 }
29}