diff options
author | bobo1on1 <bobo1on1@svn> | 2010-03-15 13:41:20 +0000 |
---|---|---|
committer | bobo1on1 <bobo1on1@svn> | 2010-03-15 13:41:20 +0000 |
commit | 381b6b278c886c01778a08bc5682894c73c10556 (patch) | |
tree | c195bc1adfd9219cf215a3220cef176c859e7d86 /system/shaders/convolution-6x6.glsl | |
parent | 09f060112d8ec8024f32e09ad4484c778fdc4a9b (diff) |
changed: use textureOffset to get pixels, this increases performance by 12% but requires glsl 1.30
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28588 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'system/shaders/convolution-6x6.glsl')
-rw-r--r-- | system/shaders/convolution-6x6.glsl | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/system/shaders/convolution-6x6.glsl b/system/shaders/convolution-6x6.glsl index f37dd6105a..ef9e8bc479 100644 --- a/system/shaders/convolution-6x6.glsl +++ b/system/shaders/convolution-6x6.glsl @@ -14,12 +14,12 @@ uniform float m_stretch; #if (HAS_FLOAT_TEXTURE) half3 weight(float pos) { - return texture1D(kernelTex, pos).rgb; + return texture(kernelTex, pos).rgb; } #else half3 weight(float pos) { - return texture1D(kernelTex, pos).rgb * 2.0 - 1.0; + return texture(kernelTex, pos).rgb * 2.0 - 1.0; } #endif @@ -36,20 +36,15 @@ vec2 stretch(vec2 pos) #endif } -half3 pixel(float xpos, float ypos) -{ - return texture2D(img, vec2(xpos, ypos)).rgb; -} - -half3 line (float ypos, vec3 xpos1, vec3 xpos2, half3 linetaps1, half3 linetaps2) +half3 line (vec2 pos, const int yoffset, half3 linetaps1, half3 linetaps2) { return - pixel(xpos1.r, ypos) * linetaps1.r + - pixel(xpos1.g, ypos) * linetaps2.r + - pixel(xpos1.b, ypos) * linetaps1.g + - pixel(xpos2.r, ypos) * linetaps2.g + - pixel(xpos2.g, ypos) * linetaps1.b + - pixel(xpos2.b, ypos) * linetaps2.b; + textureOffset(img, pos, ivec2(-2, yoffset)).rgb * linetaps1.r + + textureOffset(img, pos, ivec2(-1, yoffset)).rgb * linetaps2.r + + textureOffset(img, pos, ivec2( 0, yoffset)).rgb * linetaps1.g + + textureOffset(img, pos, ivec2( 1, yoffset)).rgb * linetaps2.g + + textureOffset(img, pos, ivec2( 2, yoffset)).rgb * linetaps1.b + + textureOffset(img, pos, ivec2( 3, yoffset)).rgb * linetaps2.b; } void main() @@ -70,17 +65,15 @@ void main() columntaps1 /= sum; columntaps2 /= sum; - vec2 xystart = (-1.5 - f) * stepxy + pos; - vec3 xpos1 = vec3(xystart.x, xystart.x + stepxy.x, xystart.x + stepxy.x * 2.0); - vec3 xpos2 = vec3(xystart.x + stepxy.x * 3.0, xystart.x + stepxy.x * 4.0, xystart.x + stepxy.x * 5.0); + vec2 xystart = (0.5 - f) * stepxy + pos; gl_FragColor.rgb = - line(xystart.y , xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r + - line(xystart.y + stepxy.y , xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r + - line(xystart.y + stepxy.y * 2.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g + - line(xystart.y + stepxy.y * 3.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g + - line(xystart.y + stepxy.y * 4.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b + - line(xystart.y + stepxy.y * 5.0, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b; + line(xystart, -2, linetaps1, linetaps2) * columntaps1.r + + line(xystart, -1, linetaps1, linetaps2) * columntaps2.r + + line(xystart, 0, linetaps1, linetaps2) * columntaps1.g + + line(xystart, 1, linetaps1, linetaps2) * columntaps2.g + + line(xystart, 2, linetaps1, linetaps2) * columntaps1.b + + line(xystart, 3, linetaps1, linetaps2) * columntaps2.b; gl_FragColor.a = gl_Color.a; } |