= R"(#version 450
layout(location = 0) in vec2 tc;
layout(location = 0) out vec4 color;
layout(set = 0, binding = 0) uniform sampler2D samp;
layout(set = 0, binding = 2) uniform sampler2DArray history;
layout(set = 0, binding = 1, std140) uniform SpriteExtended {
vec4 mouse;
vec4 u0;
vec4 u1;
vec4 u2;
vec4 u3;
vec4 custom_uniforms[16];
vec4 audio_bands;
vec4 audio_history;
} ext;
#define history_head int(ext.u3.x + 0.5)
#define history_size max(int(ext.u3.y), 1)
void main() {
vec4 live_frame = texture(samp, tc);
int cache_layer = history_head % history_size;
vec4 cached_frame = texture(history, vec3(tc, float(cache_layer)));
color = mix(live_frame, cached_frame, 0.5);
}
)"