7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
18#define history_head int(ext.u3.x)
19#define iFrame int(ext.u2.x)
22layout(local_size_x = 16, local_size_y = 16) in;
23layout(set = 0, binding = 5, rgba8) writeonly uniform image2D outputImage;
24layout(set = 0, binding = 0) uniform sampler2D samp;
37 return clamp(p, ivec2(0), size - ivec2(1));
47 return (vec2(
clampPos(p, size)) + 0.5) / vec2(size);
57 return textureLod(samp,
pixelUv(p, size), 0.0).rgb;
66 return uvec3(clamp(color * 255.0 + 0.5, 0.0, 255.0));
94uvec3
mul8(uvec3 value,
int scale) {
95 return (value * uint(max(scale, 1))) & uvec3(255u);
103 return max(
int(round(mix(2.0, 64.0, clamp(
alpha, 0.0, 1.0)))), 1);
110#ifndef USE_HISTORY_TEXTURE_ARRAY
111#define USE_HISTORY_TEXTURE_ARRAY 1
114#if USE_HISTORY_TEXTURE_ARRAY
115layout(set = 0, binding = 2) uniform sampler2DArray history;
118uniform sampler2D textures[
SIZE];
138 index = clamp(index, 0,
SIZE - 1);
139#if USE_HISTORY_TEXTURE_ARRAY
141 return textureLod(history, vec3(uv,
float(layer)), 0.0).rgb;
143 return textureLod(textures[index], uv, 0.0).rgb;
174 ivec2 p = ivec2(gl_GlobalInvocationID.xy);
175 ivec2 size = imageSize(outputImage);
176 if (any(greaterThanEqual(p, size)))
179 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.
int effectBlockSize()
Evaluates effectBlockSize 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 mul8(uvec3 value, int scale)
Evaluates mul8 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.
vec3 historyXor(ivec2 p, ivec2 size)
Evaluates historyXor for this shader effect.
uvec3 sampleHistoryU8(int index, ivec2 p, ivec2 size)
Evaluates sampleHistoryU8 for this shader effect.
int effectHistoryIndex()
Evaluates effectHistoryIndex for this shader effect.
float sampleHistory(int index, float frequency)
Evaluates sampleHistory for this shader effect.