2019-10-10 17:40:11 +00:00
|
|
|
#version 310 es
|
|
|
|
|
|
|
|
layout(local_size_x_id = 18, local_size_z_id = 19) in;
|
|
|
|
|
|
|
|
layout(local_size_x = 2) in;
|
|
|
|
layout(local_size_y = 5) in;
|
|
|
|
layout(local_size_z = 7) in;
|
2019-10-17 13:08:40 +00:00
|
|
|
|
2019-10-10 17:40:11 +00:00
|
|
|
const int total = gl_MaxComputeWorkGroupCount.x
|
|
|
|
+ gl_MaxComputeWorkGroupCount.y
|
|
|
|
+ gl_MaxComputeWorkGroupCount.z
|
|
|
|
+ gl_MaxComputeUniformComponents
|
|
|
|
+ gl_MaxComputeTextureImageUnits;
|
|
|
|
|
|
|
|
shared vec4 s[total];
|
|
|
|
|
|
|
|
int arrX[gl_WorkGroupSize.x];
|
|
|
|
int arrY[gl_WorkGroupSize.y];
|
|
|
|
int arrZ[gl_WorkGroupSize.z];
|
|
|
|
|
2019-10-17 13:08:40 +00:00
|
|
|
layout(binding = 0, set = 0) buffer bName {
|
|
|
|
int size;
|
|
|
|
uvec3 count;
|
|
|
|
vec4 data[];
|
|
|
|
} bInst;
|
|
|
|
|
2019-10-10 17:40:11 +00:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
barrier();
|
2019-10-17 13:08:40 +00:00
|
|
|
|
|
|
|
bInst.data[bInst.size / 2] *= vec4(7.0);
|
|
|
|
|
2019-10-10 17:40:11 +00:00
|
|
|
memoryBarrier();
|
|
|
|
groupMemoryBarrier();
|
2019-10-17 13:08:40 +00:00
|
|
|
memoryBarrierShared();
|
|
|
|
memoryBarrierBuffer();
|
|
|
|
|
|
|
|
s[3] = vec4(0, arrX[0], arrY[0], arrZ[0]);
|
|
|
|
bInst.count = gl_NumWorkGroups + gl_WorkGroupSize + gl_WorkGroupID + gl_LocalInvocationID +
|
|
|
|
gl_GlobalInvocationID * gl_LocalInvocationIndex;
|
2019-10-18 07:03:11 +00:00
|
|
|
|
|
|
|
atomicAdd(bInst.size, 2);
|
|
|
|
atomicMin(bInst.size, 2);
|
|
|
|
atomicMax(bInst.size, 2);
|
|
|
|
atomicAnd(bInst.size, 2);
|
|
|
|
atomicOr(bInst.size, 2);
|
|
|
|
atomicXor(bInst.size, 2);
|
|
|
|
atomicExchange(bInst.size, 2);
|
|
|
|
atomicCompSwap(bInst.size, 5, 2);
|
2019-10-10 17:40:11 +00:00
|
|
|
}
|