8layout(set = 0, binding = 1, std140) uniform SpriteExtended {
14 vec4 custom_uniforms[16];
19#define history_head int(ext.u3.x)
20#define iFrame int(ext.u2.x)
21#define time_f ext.u2.y
23layout(local_size_x = 8, local_size_y = 8) in;
24layout(set = 0, binding = 5, rgba8) writeonly uniform image2D outputImage;
25layout(set = 0, binding = 0) uniform sampler2D samp;
32#ifndef USE_HISTORY_TEXTURE_ARRAY
33#define USE_HISTORY_TEXTURE_ARRAY 1
35#if USE_HISTORY_TEXTURE_ARRAY
36layout(set = 0, binding = 2) uniform sampler2DArray history;
39uniform sampler2D textures[
SIZE];
57 return textureLod(samp, uv, 0.0);
68 index = clamp(index, 0, min(
SIZE, 8) - 1);
69#if USE_HISTORY_TEXTURE_ARRAY
70 return textureLod(history, vec3(uv,
float((
history_head + index) %
SIZE)), 0.0);
72 if (index == 0)
return textureLod(textures[0], uv, 0.0);
74 if (index == 1)
return textureLod(textures[1], uv, 0.0);
77 if (index == 2)
return textureLod(textures[2], uv, 0.0);
80 if (index == 3)
return textureLod(textures[3], uv, 0.0);
83 if (index == 4)
return textureLod(textures[4], uv, 0.0);
86 if (index == 5)
return textureLod(textures[5], uv, 0.0);
89 if (index == 6)
return textureLod(textures[6], uv, 0.0);
92 return textureLod(textures[7], uv, 0.0);
94 return textureLod(textures[0], uv, 0.0);
103float luminance(vec3 c) {
return dot(c, vec3(0.2126, 0.7152, 0.0722)); }
109vec3
acid_palette(
float p) {
return 0.5 + 0.5 * cos(6.2831853 * (p + vec3(0.08, 0.42, 0.76))); }
115 uint lane = gl_LocalInvocationIndex;
116 ivec2 origin = ivec2(gl_WorkGroupID.xy) * 8 - 1;
117 for (uint index = lane; index < 100u; index += 64u) {
118 ivec2 q = ivec2(
int(index % 10u),
int(index / 10u));
129 ivec2 size = imageSize(outputImage);
131 uint lane = gl_LocalInvocationIndex;
132 ivec2 local_id = ivec2(gl_LocalInvocationID.xy);
133 ivec2 q = local_id + 1;
134 ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);
135 vec4 value =
tile[q.y][q.x];
136 float checker = ((local_id.x + local_id.y) & 1) == 0 ? 1.0 : -1.0;
140 for (uint stride = 32u; stride > 0u; stride >>= 1u) {
147 if (any(greaterThanEqual(pixel, size)))
return;
150 float quantization = 3.0 + floor(10.0 *
alpha);
151 high_frequency = floor(high_frequency * quantization + 0.5) / quantization;
152 vec3 reconstructed = dc + high_frequency * checker * 2.5;
154 vec3 result = mix(reconstructed, memory, 0.2);
156 imageStore(outputImage, pixel, vec4(clamp(result, 0.0, 1.0), 1.0));
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
vec3 source_at(vec2 position, ivec2 size)
Evaluates source at for this shader effect.
vec3 acid_palette(float phase, float hue_offset)
Evaluates acid palette for this shader effect.
ivec2 clamp_position(ivec2 p, ivec2 s)
Evaluates clamp position for this shader effect.
vec4 history_at(int index, ivec2 p, ivec2 s)
Evaluates history at for this shader effect.
shared vec4 checker_reduction[64]
shared vec4 dc_reduction[64]
void load_tile(ivec2 size)
Evaluates load tile for this shader effect.
float luminance(vec3 c)
Evaluates luminance for this shader effect.