blob: 2f64d24c88c377a2af6b0526262214d92cebc398 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifdef GPUINDEXING
layout(binding=0, std430) buffer offsetBuffer
{
uint offset[];
};
#define count offset
#else
layout(binding=2, std430) buffer countBuffer
{
uint count[];
};
#endif
layout(binding=0) uniform atomic_uint elements;
layout(binding=1, std430) buffer indexBuffer
{
uint index[];
};
uniform uint width;
void main()
{
uint pixel=uint(gl_FragCoord.y)*width+uint(gl_FragCoord.x);
uint Count=index[pixel];
if(Count > 0u)
count[(index[pixel]=atomicCounterIncrement(elements))]=Count;
discard;
}
|