#version 430 core

layout(binding = 0) uniform usampler2D nearStencil;
layout(r32ui, binding = 0) uniform uimage2D counts;
layout(pixel_center_integer) in vec4 gl_FragCoord;

void main()
{
  if (texelFetch(nearStencil, ivec2(gl_FragCoord.xy), 0).x != 0u)
  {
    imageAtomicAdd(counts, ivec2(gl_FragCoord.xy), 1);
  }
}
