// LENS FLARES correct position!
#version 450

invariant gl_Position;

struct ARTISTIC_LF_CONSTANT_BUFFER
{
    vec4 _vTransform1;
    vec4 _vTransform2;
    vec4 _vColor;
};


// Vk3DVision (http://3dsurroundgaming.com/) - Stereo Injection
layout(set = 0, binding = 99, std140) uniform Vk3DParams
{
    vec4 stereo;
    vec4 custom_params;
} vk3d_params;

layout(set = 0, binding = 54, std140) uniform dyn_CONSTANT_BUFFER_BLOCK_2
{
    ARTISTIC_LF_CONSTANT_BUFFER _Lensflares;
} _32;

layout(set = 0, binding = 46, std430) buffer stc_occCounter_Layout
{
    uint occCounter[];
} _70;

layout(set = 0, binding = 44, std430) buffer stc_InputPixelCountHistoryBuffer_Layout
{
    float InputPixelCountHistoryBuffer[];
} _82;

layout(set = 0, binding = 45, std430) buffer stc_OutputPixelCountHistoryBuffer_Layout
{
    float OutputPixelCountHistoryBuffer[];
} _121;

layout(location = 0) in vec4 in_vfMsPosition;
layout(location = 8) out vec2 out_vfTexCoord;
layout(location = 8) in vec2 in_vfTexCoord;
layout(location = 9) out vec4 out_vfColor;

void main()
{
    vec2 _38 = _32._Lensflares._vTransform1.xy * in_vfMsPosition.x;
    vec2 _44 = _32._Lensflares._vTransform1.zw * in_vfMsPosition.y;
    vec2 _45 = _38 + _44;
    vec2 _50 = _45 + _32._Lensflares._vTransform2.xy;
    vec4 _54 = vec4(_50.x, _50.y, gl_Position.z, gl_Position.w);
    gl_Position = _54;

// Vk3DVision (http://3dsurroundgaming.com/) - Stereo Injection
    gl_Position.z = _32._Lensflares._vTransform2.z;
    gl_Position.w = 1.0;

// Vk3DVision (http://3dsurroundgaming.com/) - Stereo Injection
gl_Position.x += vk3d_params.stereo.x * (1.0 - gl_Position.z * vk3d_params.stereo.y); 
    uint _73 = _70.occCounter[0];
    float _85 = _82.InputPixelCountHistoryBuffer[0];
    float _90 = clamp(float(_73) / _32._Lensflares._vTransform2.w, 0.0, 1.0);
    float _117 = mix(_85, _90, min(clamp(_32._Lensflares._vTransform2.w * 0.004999999888241291046142578125, 0.0500000007450580596923828125, 1.0) + (abs(_85 - _90) * min(_32._Lensflares._vTransform2.w * 0.006666666828095912933349609375, 0.949999988079071044921875)), 1.0));
    _121.OutputPixelCountHistoryBuffer[0] = _117;
    out_vfTexCoord = in_vfTexCoord;
    vec3 _135 = _32._Lensflares._vColor.xyz * _117;
    out_vfColor = vec4(_135.x, _135.y, _135.z, out_vfColor.w);
    out_vfColor.w = 1.0;
}



