#include "oit.h" void StoreFrag (vec4 color, float depth) { int index = atomicAdd (numFragments, 1); ivec3 coord = ivec3(gl_FragCoord.xy, gl_ViewIndex); if (index < maxFragments) { int prevIndex = imageAtomicExchange (heads, coord, index); fragments[index].color = color; fragments[index].depth = depth; fragments[index].next = prevIndex; } }