//
struct VS_IN
{
    float4 position : POSITION;
    float2 tex_coord : TEXCOORD0;
};

struct VS_OUT
{
    float4 position : SV_Position;
    float2 texcoord : TEXCOORD0;
};

VS_OUT vs_main(VS_IN IN)
{
    VS_OUT OUT;
    OUT.position = IN.position;
    OUT.texcoord = IN.tex_coord;
    return OUT;
};

Texture2D<float4> stretched_scene;
sampler tex_samp;
float2 one_pixel_offset : register(c0);

float4 ps_main(VS_OUT IN) : SV_Target
{
    float4 c1, c2, c3, c4, c5, c6, c7;
#if HORIZONTAL_PASS == 1
    float2 x_one_pixel_offset = float2(one_pixel_offset.x, 0);
    c1 = stretched_scene.Sample(tex_samp, IN.texcoord);
    c2 = stretched_scene.Sample(tex_samp, IN.texcoord - x_one_pixel_offset);
    c3 = stretched_scene.Sample(tex_samp, IN.texcoord - 2*x_one_pixel_offset);
    c4 = stretched_scene.Sample(tex_samp, IN.texcoord + x_one_pixel_offset);
    c5 = stretched_scene.Sample(tex_samp, IN.texcoord + 2*x_one_pixel_offset);
    c6 = stretched_scene.Sample(tex_samp, IN.texcoord + 3*x_one_pixel_offset);
    c7 = stretched_scene.Sample(tex_samp, IN.texcoord - 3*x_one_pixel_offset);
#endif
#if HORIZONTAL_PASS == 0
    float2 y_one_pixel_offset = float2(0, one_pixel_offset.y);
    c1 = stretched_scene.Sample(tex_samp, IN.texcoord);
    c2 = stretched_scene.Sample(tex_samp, IN.texcoord - y_one_pixel_offset);
    c3 = stretched_scene.Sample(tex_samp, IN.texcoord - 2*y_one_pixel_offset);
    c4 = stretched_scene.Sample(tex_samp, IN.texcoord + y_one_pixel_offset);
    c5 = stretched_scene.Sample(tex_samp, IN.texcoord + 2*y_one_pixel_offset);
    c6 = stretched_scene.Sample(tex_samp, IN.texcoord + 3*y_one_pixel_offset);
    c7 = stretched_scene.Sample(tex_samp, IN.texcoord - 3*y_one_pixel_offset);
#endif    
    float3 final_color = 0.09*c6.xyz + 0.12149*c3.xyz + 0.29906*c2.xyz + 0.35514*c1.xyz + 0.29906*c4.xyz + 0.12149*c5.xyz + 0.09*c7.xyz;
    return float4(final_color, 1);
};  