35 lines
785 B
Plaintext
35 lines
785 B
Plaintext
#version 450
|
|
|
|
/* built in:
|
|
in uvec3 gl_NumWorkGroups;
|
|
in uvec3 gl_WorkGroupID;
|
|
in uvec3 gl_LocalInvocationID;
|
|
in uvec3 gl_GlobalInvocationID;
|
|
in uint gl_LocalInvocationIndex;
|
|
*/
|
|
layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in;
|
|
layout(constant_id = 1) const uint SAMPLE_MULTIPLIER = 1;
|
|
|
|
// Push constant
|
|
layout(push_constant) uniform PushStruct
|
|
{
|
|
uint size;
|
|
}
|
|
p;
|
|
|
|
layout(binding = 0) buffer inoutBufer { uint data[]; };
|
|
layout(binding = 1) buffer offsetBufer { uint offsets[]; };
|
|
|
|
void main()
|
|
{
|
|
uint tid = gl_LocalInvocationID.x;
|
|
uint group_id = gl_WorkGroupID.x;
|
|
|
|
uint gid0 = group_id * 256 + 2 * tid;
|
|
uint gid1 = group_id * 256 + 2 * tid + 1;
|
|
|
|
uint offset = offsets[group_id - 1];
|
|
data[gid0] += offset;
|
|
data[gid1] += offset;
|
|
}
|