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

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

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

float2 inv_texture_size : register(c0);

Texture2D<float3> scene_texture : register(t0);

sampler tex_samp : register(s0);

float4 ps_main(VS_OUT IN) : SV_Target
{

    float4 tex_coord = float4(IN.tex_coord.x, IN.tex_coord.y, 0, 0);
    tex_coord.zw = IN.tex_coord + inv_texture_size/2;
    tex_coord.xy = IN.tex_coord - inv_texture_size/2;

    float3 lu_color = scene_texture.Sample(tex_samp, tex_coord.xy);
    float3 ld_color = scene_texture.Sample(tex_samp, tex_coord.xw);
    float3 ru_color = scene_texture.Sample(tex_samp, tex_coord.zy);
    float3 rd_color = scene_texture.Sample(tex_samp, tex_coord.zw);

    return float4((lu_color + ld_color + ru_color + rd_color) / 4, 1);
};

    