#version 450

layout(location = 0) in vec2 uv;
layout(location = 0) out vec4 outColor;

layout(binding = 0) uniform sampler2D inputTexture;

layout(push_constant) uniform Push {
    vec2 direction;
    vec2 texelSize;
} pc;

void main()
{
    float weights[5] = float[](
        0.227027,
        0.1945946,
        0.1216216,
        0.054054,
        0.016216
    );

    vec3 result = texture(inputTexture, uv).rgb * weights[0];

    float radius = 2.0;
    for (int i = 1; i < 5; i++) {
        vec2 offset = pc.direction * pc.texelSize * float(i) * radius;

        result += texture(inputTexture, uv + offset).rgb * weights[i];
        result += texture(inputTexture, uv - offset).rgb * weights[i];
    }

    outColor = vec4(result, 1.0);
}