summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTorsten Jager <t.jager@gmx.de>2014-05-02 15:03:50 +0200
committerTorsten Jager <t.jager@gmx.de>2014-05-02 15:03:50 +0200
commit3136e508a2311641f35836029c8dbd05abc99c0b (patch)
treef161a069d9f1ef7aecbba45abf108fab38f8b7bd /src
parentf19379fc06ced1f87249bc5927bb802cf9fb9fbf (diff)
downloadxine-lib-3136e508a2311641f35836029c8dbd05abc99c0b.tar.gz
xine-lib-3136e508a2311641f35836029c8dbd05abc99c0b.tar.bz2
vo_opengl2: simplify fragment shaders.
That 0.5 thing is OK as all texture coordinates refer to the middle of a pixel. However, we dont need abs() as the diff already is 0.0 <= diff < 1.0 .
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_opengl2.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/video_out/video_out_opengl2.c b/src/video_out/video_out_opengl2.c
index 3a2476dbe..c6ece1aec 100644
--- a/src/video_out/video_out_opengl2.c
+++ b/src/video_out/video_out_opengl2.c
@@ -188,13 +188,11 @@ static const char *bicubic_pass1_frag=
"void main() {\n"
" vec2 coord = gl_TexCoord[0].xy;\n"
" vec2 TexCoord = vec2( floor( coord.x - 0.5 ) + 0.5, coord.y );\n"
-" vec4 sum = vec4( 0.0 );\n"
-" mat4 wlut;\n"
-" wlut[0] = texture2DRect( lut, vec2( abs( coord.x - TexCoord.x ) * 1000.0, spline ) );\n"
-" for( int x = -1; x <= 2; x++ ) {\n"
-" vec4 col = texture2DRect( tex, TexCoord + vec2( float( x ), 0.0) );\n"
-" sum += col * wlut[0][x+1];\n"
-" }\n"
+" vec4 wlut = texture2DRect( lut, vec2( ( coord.x - TexCoord.x ) * 1000.0, spline ) );\n"
+" vec4 sum = texture2DRect( tex, TexCoord + vec2( -1.0, 0.0) ) * wlut[0];\n"
+" sum += texture2DRect( tex, TexCoord ) * wlut[1];\n"
+" sum += texture2DRect( tex, TexCoord + vec2( 1.0, 0.0) ) * wlut[2];\n"
+" sum += texture2DRect( tex, TexCoord + vec2( 2.0, 0.0) ) * wlut[3];\n"
" gl_FragColor = sum;\n"
"}\n";
@@ -207,13 +205,11 @@ static const char *bicubic_pass2_frag=
"void main() {\n"
" vec2 coord = gl_TexCoord[0].xy;\n"
" vec2 TexCoord = vec2( coord.x, floor( coord.y - 0.5 ) + 0.5 );\n"
-" vec4 sum = vec4( 0.0 );\n"
-" mat4 wlut;\n"
-" wlut[0] = texture2DRect( lut, vec2( abs( coord.y - TexCoord.y ) * 1000.0, spline ) );\n"
-" for( int y = -1; y <= 2; y++ ) {\n"
-" vec4 col = texture2DRect( tex, TexCoord + vec2( 0.0, float( y ) ) );\n"
-" sum += col * wlut[0][y+1];\n"
-" }\n"
+" vec4 wlut = texture2DRect( lut, vec2( ( coord.y - TexCoord.y ) * 1000.0, spline ) );\n"
+" vec4 sum = texture2DRect( tex, TexCoord + vec2( 0.0, -1.0 ) ) * wlut[0];\n"
+" sum += texture2DRect( tex, TexCoord ) * wlut[1];\n"
+" sum += texture2DRect( tex, TexCoord + vec2( 0.0, 1.0 ) ) * wlut[2];\n"
+" sum += texture2DRect( tex, TexCoord + vec2( 0.0, 2.0 ) ) * wlut[3];\n"
" gl_FragColor = sum;\n"
"}\n";