gKit2 light
Toggle main menu visibility
Loading...
Searching...
No Matches
gkit2_tutos
M2
histogram1.glsl
1
2
// version directe, pas tres rapide...
3
4
#version 430
5
6
#ifdef COMPUTE_SHADER
7
8
layout(std430, binding= 0) coherent buffer HistogramData
9
{
10
int
histogram[16];
11
};
12
13
// image resultat
14
layout(binding= 0, rgba8) readonly uniform image2D image;
15
16
layout(local_size_x= 8, local_size_y= 8) in;
17
void
main( )
18
{
19
vec4
pixel= imageLoad(image, ivec2(gl_GlobalInvocationID.xy));
20
21
// calculer la cellule de l'histogramme pour le pixel
22
float
grey= (pixel.r + pixel.g + pixel.b) / 3;
// entre 0 et 1
23
int
bin= int(grey * 15);
24
25
atomicAdd(histogram[bin], 1);
26
}
27
28
#endif
vec4
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition
vec.h:192
Generated on
for gKit2 light by
1.17.0