7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
17#define history_head int(ext.u3.x)
20layout(local_size_x = 16, local_size_y = 16) in;
21layout(set = 0, binding = 5, rgba8) writeonly uniform image2D outputImage;
22layout(set = 0, binding = 0) uniform sampler2D samp;
33 return clamp(p, ivec2(0), size - ivec2(1));
43 return (vec2(
clampPos(p, size)) + 0.5) / vec2(size);
53 return textureLod(samp,
pixelUv(p, size), 0.0).rgb;
62 return uvec3(clamp(color * 255.0 + 0.5, 0.0, 255.0));
88#ifndef USE_HISTORY_TEXTURE_ARRAY
89#define USE_HISTORY_TEXTURE_ARRAY 1
92#if USE_HISTORY_TEXTURE_ARRAY
93layout(set = 0, binding = 2) uniform sampler2DArray history;
96uniform sampler2D textures[
SIZE];
108 index = clamp(index, 0,
SIZE - 1);
109#if USE_HISTORY_TEXTURE_ARRAY
111 return textureLod(history, vec3(uv,
float(layer)), 0.0).rgb;
113 return textureLod(textures[index], uv, 0.0).rgb;
135 uvec3 accumulated = uvec3(0u);
136 for (
int index = 0; index <
SIZE; ++index)
138 uvec3 value = (accumulated + uvec3(1u)) & uvec3(255u);
146 ivec2 p = ivec2(gl_GlobalInvocationID.xy);
147 ivec2 size = imageSize(outputImage);
148 if (any(greaterThanEqual(p, size)))
151 imageStore(outputImage, p, vec4(clamp(color, 0.0, 1.0), 1.0));
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
ivec2 clampPos(ivec2 p, ivec2 size)
Evaluates clampPos for this shader effect.
vec2 pixelUv(ivec2 p, ivec2 size)
Evaluates pixelUv for this shader effect.
vec3 sampleSource(ivec2 p, ivec2 size)
Evaluates sampleSource for this shader effect.
uvec3 toU8(vec3 color)
Evaluates toU8 for this shader effect.
vec3 toRGB(uvec3 color)
Evaluates toRGB for this shader effect.
uvec3 sampleSourceU8(ivec2 p, ivec2 size)
Evaluates sampleSourceU8 for this shader effect.
uvec3 sampleHistoryU8(int index, ivec2 p, ivec2 size)
Evaluates sampleHistoryU8 for this shader effect.
float sampleHistory(int index, float frequency)
Evaluates sampleHistory for this shader effect.
vec3 xorHistory(ivec2 p, ivec2 size)
Evaluates xorHistory for this shader effect.