kwin/effects/data/blur.vert
Rivo Laks 213833fc7f Finally make the bloody blur effect work properly.
This fixes the artefacts appearing when only part of the screen is updated.
This version also brings ton of optimizations which might well increase performance
  2 or 3 times on slower cards:
- Windows are not drawn twice anymore. Now they're drawn only to render target and
  later changed parts of the render target are copied back onto screen.
- Shaders have been optimized. Some calculations moved from pixel shader to vertex shader.
- For ARGB windows, if window's opacity is 0 then it will stay transparent instead of being
  replaced by blurred background.
- Blur effect should now play nicer with other effects, e.g. shadows.

svn path=/trunk/KDE/kdebase/workspace/; revision=748502
2007-12-14 16:57:38 +00:00

28 lines
700 B
GLSL

varying vec2 samplePos1;
varying vec2 samplePos2;
varying vec2 samplePos3;
varying vec2 samplePos4;
varying vec2 samplePos5;
uniform float textureWidth;
uniform float textureHeight;
attribute float xBlur;
attribute float yBlur;
vec2 mkSamplePos(vec2 origin, float offset)
{
vec2 foo = origin + vec2(xBlur, yBlur) * offset;
return vec2(foo.x / textureWidth, 1.0 - foo.y / textureHeight);
}
void main()
{
samplePos1 = mkSamplePos(gl_Vertex.xy, 0.0);
samplePos2 = mkSamplePos(gl_Vertex.xy, -1.5);
samplePos3 = mkSamplePos(gl_Vertex.xy, 1.5);
samplePos4 = mkSamplePos(gl_Vertex.xy, 3.5);
samplePos5 = mkSamplePos(gl_Vertex.xy, -3.5);
gl_Position = ftransform();
}