1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#version 450
shared float scratch[64];
layout(set = 0, binding = 0) buffer params_Block {
uint count;
float scale;
} params;
layout(set = 0, binding = 1) buffer data_Block {
float values[64];
} data;
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
void main() {
uint idx = gl_LocalInvocationID.x;
scratch[idx] = (data.values[idx] * params.scale);
barrier();
if ((idx < 32)) {
scratch[idx] = (scratch[idx] + scratch[(idx + 32)]);
}
barrier();
data.values[idx] = scratch[idx];
}