diff options
author | Torsten Jager <t.jager@gmx.de> | 2014-05-07 18:07:35 +0200 |
---|---|---|
committer | Torsten Jager <t.jager@gmx.de> | 2014-05-07 18:07:35 +0200 |
commit | 398cfce1c7cd903a2dcd2f36c2fed5c177eedc82 (patch) | |
tree | 40b8c813bf8f71a6107ac0b49d7605e2e708eda0 /src | |
parent | 7040738102ad85b68b19be78b9e1f6f65680afc9 (diff) | |
download | xine-lib-398cfce1c7cd903a2dcd2f36c2fed5c177eedc82.tar.gz xine-lib-398cfce1c7cd903a2dcd2f36c2fed5c177eedc82.tar.bz2 |
vo_opengl2: turn off GL_LINEAR when not needed.
User fragment shaders are probably unaffected anyway,
but the 1:1 case may get a bit faster.
Diffstat (limited to 'src')
-rw-r--r-- | src/video_out/video_out_opengl2.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/video_out/video_out_opengl2.c b/src/video_out/video_out_opengl2.c index c6ece1aec..145a039bc 100644 --- a/src/video_out/video_out_opengl2.c +++ b/src/video_out/video_out_opengl2.c @@ -1140,8 +1140,6 @@ static int opengl2_draw_video_bicubic( opengl2_driver_t *that, int guiw, int gui glEnd(); glActiveTexture( GL_TEXTURE0 ); - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glViewport( 0, 0, guiw, guih ); @@ -1198,6 +1196,8 @@ static int opengl2_draw_video_cubic_x( opengl2_driver_t *that, int guiw, int gui glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_RECTANGLE_ARB, video_texture ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glActiveTexture( GL_TEXTURE1 ); glBindTexture( GL_TEXTURE_RECTANGLE_ARB, that->bicubic_lut_texture ); glUseProgram( that->bicubic_pass1_program.program ); @@ -1241,6 +1241,8 @@ static int opengl2_draw_video_cubic_y( opengl2_driver_t *that, int guiw, int gui glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_RECTANGLE_ARB, video_texture ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glActiveTexture( GL_TEXTURE1 ); glBindTexture( GL_TEXTURE_RECTANGLE_ARB, that->bicubic_lut_texture ); glUseProgram( that->bicubic_pass2_program.program ); @@ -1262,6 +1264,35 @@ static int opengl2_draw_video_cubic_y( opengl2_driver_t *that, int guiw, int gui +static int opengl2_draw_video_simple( opengl2_driver_t *that, int guiw, int guih, GLfloat u, GLfloat v, GLfloat u1, GLfloat v1, + GLfloat x, GLfloat y, GLfloat x1, GLfloat y1, GLuint video_texture ) +{ + glViewport( 0, 0, guiw, guih ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0.0, guiw, guih, 0.0, -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glActiveTexture( GL_TEXTURE0 ); + glBindTexture( GL_TEXTURE_RECTANGLE_ARB, video_texture ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); + + glBegin( GL_QUADS ); + glTexCoord2f( u, v ); glVertex3f( x, y, 0.); + glTexCoord2f( u, v1 ); glVertex3f( x, y1, 0.); + glTexCoord2f( u1, v1 ); glVertex3f( x1, y1, 0.); + glTexCoord2f( u1, v ); glVertex3f( x1, y, 0.); + glEnd(); + + return 1; +} + + + static void opengl2_draw_video_bilinear( opengl2_driver_t *that, int guiw, int guih, GLfloat u, GLfloat v, GLfloat u1, GLfloat v1, GLfloat x, GLfloat y, GLfloat x1, GLfloat y1, GLuint video_texture ) { @@ -1276,6 +1307,8 @@ static void opengl2_draw_video_bilinear( opengl2_driver_t *that, int guiw, int g glActiveTexture( GL_TEXTURE0 ); glBindTexture( GL_TEXTURE_RECTANGLE_ARB, video_texture ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glBegin( GL_QUADS ); glTexCoord2f( u, v ); glVertex3f( x, y, 0.); @@ -1399,8 +1432,12 @@ static void opengl2_draw( opengl2_driver_t *that, opengl2_frame_t *frame ) res = opengl2_draw_video_bicubic( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); else res = opengl2_draw_video_cubic_x( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); - } else if ( that->sc.displayed_height != that->sc.output_height ) - res = opengl2_draw_video_cubic_y( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); + } else { + if ( that->sc.displayed_height != that->sc.output_height ) + res = opengl2_draw_video_cubic_y( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); + else + res = opengl2_draw_video_simple( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); + } } if (!res) opengl2_draw_video_bilinear( that, that->sc.gui_width, that->sc.gui_height, u, v, u1, v1, x, y, x1, y1, video_texture ); |