// SSR STUFF
#version 450

layout(set = 0, binding = 0, std140) uniform freqHigh_fragmentUniforms_ubo
{
    vec4 renderpositiontoviewtexture;
    vec4 texsize;
} freqHigh_fragmentUniforms;

layout(set = 0, binding = 1, std140) uniform freqLow_fragmentUniforms_ubo
{
    vec4 projectionmatrixz;
} freqLow_fragmentUniforms;

layout(set = 0, binding = 2) uniform sampler2D samp_tex0;

layout(location = 0) out vec4 out_FragColor0;

vec2 screenPosToTexcoord(vec2 pos, vec4 bias_scale)
{
    return (pos * bias_scale.zw) + bias_scale.xy;
}

vec4 tex2Dlod(sampler2D image, vec4 texcoord)
{
    return textureLod(image, texcoord.xy, texcoord.w);
}

float GetNdcDepth(float linearZ, vec4 projectionMatrixZ)
{
    float ndcZ = (projectionMatrixZ.w / linearZ) - projectionMatrixZ.z;
    return ndcZ;
}

void main()
{
    vec2 param = gl_FragCoord.xy;
    vec4 param_1 = freqHigh_fragmentUniforms.renderpositiontoviewtexture;
    vec2 tc = screenPosToTexcoord(param, param_1);
    out_FragColor0.x = 0.0;
    bool _90 = tc.x < freqHigh_fragmentUniforms.texsize.x;
    bool _99;
    if (_90)
    {
        _99 = tc.y < freqHigh_fragmentUniforms.texsize.y;
    }
    else
    {
        _99 = _90;
    }
    if (_99)
    {
        vec4 param_2 = vec4(tc + (freqHigh_fragmentUniforms.texsize.zw * vec2(0.0)), 0.0, 0.0);
        float dz0 = tex2Dlod(samp_tex0, param_2).x;
        vec4 param_3 = vec4(tc + (freqHigh_fragmentUniforms.texsize.zw * vec2(1.0, 0.0)), 0.0, 0.0);
        float dz1 = tex2Dlod(samp_tex0, param_3).x;
        vec4 param_4 = vec4(tc + (freqHigh_fragmentUniforms.texsize.zw * vec2(0.0, 1.0)), 0.0, 0.0);
        float dz2 = tex2Dlod(samp_tex0, param_4).x;
        vec4 param_5 = vec4(tc + (freqHigh_fragmentUniforms.texsize.zw * vec2(1.0)), 0.0, 0.0);
        float dz3 = tex2Dlod(samp_tex0, param_5).x;
        float dz = max(max(dz0, dz1), max(dz2, dz3));
        float param_6 = 3.5;
        vec4 param_7 = freqLow_fragmentUniforms.projectionmatrixz;
        float firstPersonArmsZ = GetNdcDepth(param_6, param_7);
        float _178;
        if (dz < firstPersonArmsZ)
        {
            _178 = dz * 10.0;
        }
        else
        {
            _178 = dz;
        }
        dz = _178;
        out_FragColor0.x = 1.0 - dz;
    }
    out_FragColor0 = vec4(0);
}



