/**
 * transform color from linear to srgb space
 */
#include "version.sh"

in vec2 UV_f;
uniform vec2 blurEdge2;
uniform vec4 viewport;
uniform vec4 cornerFlag;

layout(location = 0) out vec4 fragColor;

void main()
{
    vec2 half_size = viewport.zw * 0.5f;
    vec2 pos = gl_FragCoord.xy-viewport.xy-half_size;
    int index = (pos.x >= 0.0 ? 1 : 0) + (pos.y >= 0.0 ? 2 : 0);
    float factor = cornerFlag[index];
    
    float dis2 = dot(UV_f, UV_f);
    float alpha = 1.0 - smoothstep(blurEdge2.x, blurEdge2.y, dis2) * factor;
    
    fragColor = vec4(0.0, 0.0, 0.0, alpha);
}
