diff options
Diffstat (limited to 'graphics/asymptote/base/shaders/compress.glsl')
-rw-r--r-- | graphics/asymptote/base/shaders/compress.glsl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/graphics/asymptote/base/shaders/compress.glsl b/graphics/asymptote/base/shaders/compress.glsl new file mode 100644 index 0000000000..2f64d24c88 --- /dev/null +++ b/graphics/asymptote/base/shaders/compress.glsl @@ -0,0 +1,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; +} |