44 lines
1.2 KiB
GLSL
44 lines
1.2 KiB
GLSL
#version 450
|
|
#extension GL_EXT_nonuniform_qualifier : require
|
|
|
|
layout(location = 0) in vec2 in_coords;
|
|
layout(location = 0) out vec4 out_color;
|
|
|
|
layout(set = 0, binding = 0) uniform sampler u_sampler;
|
|
layout(set = 0, binding = 1) uniform texture2D u_images[];
|
|
|
|
layout(push_constant) uniform p_constants_t
|
|
{
|
|
uint frame;
|
|
uint imageIndex;
|
|
float time;
|
|
uint loop_iterations;
|
|
};
|
|
|
|
vec3 srgbToLinear(vec3 color)
|
|
{
|
|
bvec3 isLo = lessThanEqual(color, vec3(0.04045f));
|
|
|
|
vec3 loPart = color / 12.92f;
|
|
vec3 hiPart = pow((color + 0.055f) / 1.055f, vec3(12.0f / 5.0f));
|
|
return mix(hiPart, loPart, isLo);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
out_color = vec4(0.0f);
|
|
for (uint i = 0; i < loop_iterations; i++)
|
|
{
|
|
for (uint j = 0; j < loop_iterations; j++)
|
|
{
|
|
for (uint w = 0; w < loop_iterations; w++)
|
|
{
|
|
const vec3 start = vec3(1.0f, 0.51f, 0.56f);
|
|
const vec3 end = vec3(0.48f, 0.76f, 0.84f);
|
|
vec2 coords = mix(start.xy, end.xy, vec2(float(j), float(i))) + in_coords;
|
|
out_color += texture(sampler2D(u_images[imageIndex], u_sampler), coords);
|
|
out_color.rgb = srgbToLinear(out_color.rgb);
|
|
}
|
|
}
|
|
}
|
|
} |