8 layout(std430, binding= 0) coherent buffer HistogramData
14 layout(binding= 0, rgba8) readonly uniform image2D image;
16 shared
int group_histogram[16];
18 layout(local_size_x= 8, local_size_y= 8) in;
21 vec4 pixel= imageLoad(image, ivec2(gl_GlobalInvocationID.xy));
24 float grey= (pixel.r + pixel.g + pixel.b) / 3;
25 int bin= int(grey * 15);
27 uint ID= gl_LocalInvocationIndex;
29 group_histogram[ID]= 0;
34 atomicAdd(group_histogram[bin], 1);
40 atomicAdd(histogram[ID], group_histogram[ID]);
vecteur generique 4d, ou 3d homogene, utilitaire.