1#version 310 es 2 3layout(local_size_x_id = 18, local_size_z_id = 19) in; 4 5layout(local_size_x = 2) in; 6layout(local_size_y = 5) in; 7layout(local_size_z = 7) in; 8 9const int total = gl_MaxComputeWorkGroupCount.x 10 + gl_MaxComputeWorkGroupCount.y 11 + gl_MaxComputeWorkGroupCount.z 12 + gl_MaxComputeUniformComponents 13 + gl_MaxComputeTextureImageUnits; 14 15shared vec4 s[total]; 16 17int arrX[gl_WorkGroupSize.x]; 18int arrY[gl_WorkGroupSize.y]; 19int arrZ[gl_WorkGroupSize.z]; 20 21layout(binding = 0, set = 0) buffer bName { 22 int size; 23 uvec3 count; 24 vec4 data[]; 25} bInst; 26 27void main() 28{ 29 barrier(); 30 31 bInst.data[bInst.size / 2] *= vec4(7.0); 32 33 memoryBarrier(); 34 groupMemoryBarrier(); 35 memoryBarrierShared(); 36 memoryBarrierBuffer(); 37 38 s[3] = vec4(0, arrX[0], arrY[0], arrZ[0]); 39 bInst.count = gl_NumWorkGroups + gl_WorkGroupSize + gl_WorkGroupID + gl_LocalInvocationID + 40 gl_GlobalInvocationID * gl_LocalInvocationIndex; 41 42 atomicAdd(bInst.size, 2); 43 atomicMin(bInst.size, 2); 44 atomicMax(bInst.size, 2); 45 atomicAnd(bInst.size, 2); 46 atomicOr(bInst.size, 2); 47 atomicXor(bInst.size, 2); 48 atomicExchange(bInst.size, 2); 49 atomicCompSwap(bInst.size, 5, 2); 50} 51