//
// GPS Squash - Vertical Gaussian Blur
// 13-tap separable Gaussian (based on Ren712's blur_box)
//

texture gTexture;
float2 gTexelSize = float2(1.0 / 1920.0, 1.0 / 1080.0);
float gBlurStrength = 1.0;

sampler TextureSampler = sampler_state
{
    Texture = (gTexture);
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Mirror;
    AddressV = Mirror;
};

static const float Kernel[13] = { -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6 };
static const float Weights[13] = {
    0.002216, 0.008764, 0.026995, 0.064759, 0.120985, 0.176033,
    0.199471,
    0.176033, 0.120985, 0.064759, 0.026995, 0.008764, 0.002216
};

float4 BlurPixelShader(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 color = 0;
    float2 coord;
    coord.x = texCoord.x;

    for (int i = 0; i < 13; i++)
    {
        coord.y = texCoord.y + gBlurStrength * Kernel[i] * gTexelSize.y;
        color += tex2D(TextureSampler, coord) * Weights[i];
    }

    color.a = 1;
    return color;
}

technique blur_v
{
    pass P0
    {
        PixelShader = compile ps_2_0 BlurPixelShader();
    }
}
