precision highp float;
uniform sampler2D u_image;
uniform float u_scale;
uniform vec2 u_texSize;
varying vec2 v_texCoord;

const float w1 = 0.147761;
const float w2 = 0.118318; 
const float w3 = 0.0947416; 


vec4 GaussianBlur(in sampler2D image, in vec2 texCoord, in vec2 pixelSize) {
  vec4 C00 = texture2D(image, texCoord + vec2(-pixelSize.x, -pixelSize.y)) * w3 ;
  vec4 C01 = texture2D(image, texCoord + vec2(0.0, -pixelSize.y)) * w2;
  vec4 C02 = texture2D(image, texCoord + vec2(pixelSize.x, -pixelSize.y)) * w3 ;

  vec4 C10 = texture2D(image, texCoord + vec2(-pixelSize.x, 0.0)) * w2;
  vec4 C11 = texture2D(image, texCoord + vec2(0.0, 0.0)) * w1;
  vec4 C12 = texture2D(image, texCoord + vec2(pixelSize.x, 0.0)) * w2;

  vec4 C20 = texture2D(image, texCoord + vec2(-pixelSize.x, pixelSize.y)) * w3;
  vec4 C21 = texture2D(image, texCoord + vec2(0.0, pixelSize.y)) * w2;
  vec4 C22 = texture2D(image, texCoord + vec2(pixelSize.x, pixelSize.y)) * w3;

  return 
    C00 + C01 + C02 +
    C10 + C11 + C12 +
    C20 + C21 + C22 ;
}

void main() {
  vec4 color = GaussianBlur(u_image, v_texCoord, u_texSize);
  gl_FragColor = color;
}
