#version 450

layout (local_size_x = 16, local_size_y = 16) in;
layout (set = 0, binding = 0) uniform usampler2D inputImage;
layout (set = 1, binding = 1, rgba8) uniform image2D resultImage;

layout(push_constant) uniform constants
{
	uint width;
	uint height;
} image_size;

void main()
{   
    ivec2 pixelCoords = ivec2(gl_GlobalInvocationID.xy);
    if(pixelCoords.x >= image_size.width || pixelCoords.y >= image_size.height){
        return;
    }

    vec2 textureCoords = vec2(float(pixelCoords.x) / image_size.width, float(pixelCoords.y) / image_size.height);
    
    vec4 pixel = texture(inputImage, textureCoords);
                         
    imageStore(resultImage, pixelCoords, pixel);
}
