//SMAA related. Not stereoized.
#version 450
#extension GL_EXT_nonuniform_qualifier : require

struct FlrInput
{
    uint vertexId;
};

struct FlrOutput
{
    vec4 position;
    vec2 uv0;
    vec4 offset;
};


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

layout(set = 0, binding = 0, std140) uniform PerRenderPass
{
    vec4 viewportSize;
} _28;

layout(set = 0, binding = 99, std430) buffer DebugBuffer
{
    uint debugBuffer[];
} _127;

layout(set = 2, binding = 0) uniform texture2D globalTextures[];
layout(set = 2, binding = 0) uniform textureCube globalCubeTextures[];
layout(set = 2, binding = 0) uniform texture3D global3DTextures[];
layout(set = 1, binding = 0) uniform sampler linearClampSampler;
layout(set = 1, binding = 1) uniform sampler linearRepeatSampler;
layout(set = 1, binding = 2) uniform sampler nearestClampSampler;
layout(set = 1, binding = 3) uniform sampler nearestRepeatSampler;
layout(set = 1, binding = 4) uniform sampler shadowSampler;

layout(location = 0) out vec2 outUV0;
layout(location = 1) out vec4 outOffset;

void SMAANeighborhoodBlendingVS(vec2 texcoord, out vec4 offset)
{
    offset = fma(_28.viewportSize.xyxy, vec4(1.0, 0.0, 0.0, 1.0), texcoord.xyxy);
}

void flrMain(FlrInput flrInput, inout FlrOutput flrOutput)
{
    uint vertexId = flrInput.vertexId;
    flrOutput.uv0 = vec2(float(vertexId / 2u) * 2.0, float(vertexId % 2u) * 2.0);
    flrOutput.position = vec4((float(vertexId / 2u) * 4.0) - 1.0, (float(vertexId % 2u) * 4.0) - 1.0, 0.0, 1.0);
    vec2 param = flrOutput.uv0;
    vec4 param_1;
    SMAANeighborhoodBlendingVS(param, param_1);
    flrOutput.offset = param_1;
}

void main()
{
    FlrInput flrInput;
    flrInput.vertexId = uint(gl_VertexIndex);
    FlrInput param = flrInput;
    FlrOutput param_1;
    flrMain(param, param_1);
    FlrOutput flrOutput = param_1;
    gl_Position = flrOutput.position;

// Vk3DVision (http://3dsurroundgaming.com/) - Stereo Injection
//gl_Position.x += vk3d_params.stereo.x * (gl_Position.w - vk3d_params.stereo.y);
    outUV0 = flrOutput.uv0;
    outOffset = flrOutput.offset;
}


