   }
 
   // Compute fragment data
-
   vec2 prj = v_Pos.xy / v_Pos.w;
   vec3 pos =
       (vec3(prj * 0.5 + 0.5, 1.0 - (v_Pos.z + u_ZNear) / (u_ZFar + u_ZNear)));


  // Detect main buffer overflow
  uint32_t count = atomicAdd(u_Counts + u_ScreenSz * u_ScreenSz, 1);
  // uint32_t count = atomicCounter( u_Counter );
  // atomicIncrement(u_Counts[ u_ScreenSz*u_ScreenSz ]);
  if (count > u_NumRecords)
  {
    u_Counts[u_ScreenSz * u_ScreenSz] = u_NumRecords;

  uint32_t depth = uint32_t(pos.z * MAX_DEPTH);
  uvec2 pix = uvec2(pos.xy * u_ScreenSz);

  bool success = insert_preopen(depth, pix, count);

  o_PixColor = success ? fragment.color : vec4(1, 0, 0, 0);
}

// --------------------------------------------
