git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

scenefx/render/fx_renderer/shaders/blur2.frag (822B)

 1 precision mediump float;
 2 
 3 varying mediump vec2 v_texcoord;
 4 uniform sampler2D tex;
 5 
 6 uniform float radius;
 7 uniform vec2 halfpixel;
 8 
 9 void main() {
10     vec2 uv = v_texcoord / 2.0;
11 
12     vec4 sum = texture2D(tex, uv + vec2(-halfpixel.x * 2.0, 0.0) * radius);
13 
14     sum += texture2D(tex, uv + vec2(-halfpixel.x, halfpixel.y) * radius) * 2.0;
15     sum += texture2D(tex, uv + vec2(0.0, halfpixel.y * 2.0) * radius);
16     sum += texture2D(tex, uv + vec2(halfpixel.x, halfpixel.y) * radius) * 2.0;
17     sum += texture2D(tex, uv + vec2(halfpixel.x * 2.0, 0.0) * radius);
18     sum += texture2D(tex, uv + vec2(halfpixel.x, -halfpixel.y) * radius) * 2.0;
19     sum += texture2D(tex, uv + vec2(0.0, -halfpixel.y * 2.0) * radius);
20     sum += texture2D(tex, uv + vec2(-halfpixel.x, -halfpixel.y) * radius) * 2.0;
21 
22     gl_FragColor = sum / 12.0;
23 }