2023-02-19 15:47:55 +00:00
|
|
|
#version 330 core
|
|
|
|
|
2023-04-07 06:17:37 +00:00
|
|
|
layout(location = 0) out uint fragHits;
|
2023-02-19 15:47:55 +00:00
|
|
|
|
|
|
|
uniform usampler2D partial_histogram_tex;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
ivec2 partial_histogram_size = textureSize(partial_histogram_tex, 0); // screen x 256
|
|
|
|
uint bin = uint(gl_FragCoord.x); // [0, 255]
|
|
|
|
|
|
|
|
uint hits = 0u;
|
|
|
|
|
|
|
|
for (int column = 0; column < partial_histogram_size.x; ++column) {
|
|
|
|
uint partial_hits = texelFetch(partial_histogram_tex, ivec2(column, bin), 0).r;
|
|
|
|
hits += partial_hits;
|
|
|
|
}
|
|
|
|
|
|
|
|
fragHits = hits;
|
|
|
|
}
|