#[compute]
#version 450

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

layout( rgba16f, set = 0, binding = 0) 
uniform image2D color_image;

layout(push_constant, std430)
uniform Params 
{	
	float amount;
  float radius;
  float power;
  float offset;
  vec2 raster_size;

} params;


void main() 
{
	ivec2 uv   = ivec2( gl_GlobalInvocationID.xy );
	ivec2 size = ivec2( params.raster_size );

	if ( uv.x >= size.x || uv.y >= size.y ) 
  {
		return;
	}

	vec4 color = imageLoad( color_image, uv );

  float d = length( uv - size/2 ) / length( size/2 * params.radius ); 
  d = pow( d, params.power );
  float amount = clamp( 1.0 - d + params.offset, 0.0, 1.0 );


	color.rgb = mix( color.rgb, vec3( 0.01, 0.01, 0.02 ), ( 1.0 - amount ) * params.amount );

	imageStore( color_image, uv, color );
}