#version 460

layout(std430, push_constant) uniform PushConstant {
	vec3 pos;
	float time;
	vec2 resolution;
	vec2 mouse;
	float spectrum;
	bool mouse_pressed;
} pc;

layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;

layout (binding = 0, rgba8) uniform image2D previous_frame;
layout (binding = 1, rgba8) uniform image2D generic_texture;
layout (binding = 2, rgba8) uniform image2D dummy_texture;
layout (binding = 3, r32f) uniform image2D float_texture1;
layout (binding = 4, r32f) uniform image2D float_texture2;

void main() {
    if (gl_GlobalInvocationID.x >= pc.resolution.x ||
        gl_GlobalInvocationID.y >= pc.resolution.y) {
        return;
    }

	float time = pc.time;
	vec2 p = gl_GlobalInvocationID.xy;
	float col = sin(p.x / 13.2 - cos(time) * 5) * cos(p.y / 25.1 + time);
	col = 0.;
	col = smoothstep(col, col+5.9, 0.2 + p.x/p.y);
	/* col +=  cos(p.x) + sin(p.y + time); */

	imageStore(generic_texture, ivec2(p), vec4(col));
}
