#version 450 #extension GL_GOOGLE_include_directive : require layout(local_size_x = 8, local_size_y = 8) in; #include "common.glsl" // The frame for the replay recorder at half size (2 x 2 average) when the window is wider than 1600 px: the copy to the host is a quarter // (main.cpp; a 2560 x 1360 frame is 14 MB, copied every simulation tick). layout(std430, set = 0, binding = 58) buffer ClipHalf { uint clipHalf[]; }; layout(std430, set = 0, binding = 60) readonly buffer ClipRaw { uint clipraw[]; }; // the window picture without the HUD (render.comp) void main() { const ivec2 q = ivec2(gl_GlobalInvocationID.xy); const int hw = pc.ow / 2, hh = pc.oh / 2; if (q.x >= hw || q.y >= hh) return; const int i = 2 * q.y * pc.ow + 2 * q.x; const uvec4 a = uvec4(clipraw[i], clipraw[i + 1], clipraw[i + pc.ow], clipraw[i + pc.ow + 1]); uint o = 0u; for (int c = 0; c < 32; c += 8) { const uvec4 v = (a >> uint(c)) & 0xFFu; o |= ((v.x + v.y + v.z + v.w + 2u) >> 2) << uint(c); } clipHalf[q.y * hw + q.x] = o; }