[vlc-commits] opengl: Do subtexture uploads only for the visible area

Martin Storsjö git at videolan.org
Mon Apr 1 10:11:37 CEST 2013


vlc | branch: master | Martin Storsjö <martin at martin.st> | Sat Mar 30 01:56:52 2013 +0200| [06c1f879ee191d8af073024b6d66488f64395f54] | committer: Martin Storsjö

opengl: Do subtexture uploads only for the visible area

This avoids doing the intermediate copy in some cases.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06c1f879ee191d8af073024b6d66488f64395f54
---

 modules/video_output/opengl.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 0801faa..2db2272 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -714,10 +714,10 @@ static void Upload(vout_display_opengl_t *vgl, int in_width, int in_height,
     // This unpack alignment is the default, but setting it just in case.
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 #ifndef GL_UNPACK_ROW_LENGTH
-    if ( pitch != ALIGN(full_width * pixel_pitch, 4) )
+    int dst_width = full_upload ? full_width : width;
+    int dst_pitch = ALIGN(dst_width * pixel_pitch, 4);
+    if ( pitch != dst_pitch )
     {
-        int dst_width = full_upload ? full_width : width;
-        int dst_pitch = ALIGN(dst_width * pixel_pitch, 4);
         int buf_size = dst_pitch * full_height * pixel_pitch;
         const uint8_t *source = pixels;
         uint8_t *destination;
@@ -759,7 +759,7 @@ static void Upload(vout_display_opengl_t *vgl, int in_width, int in_height,
         else
             glTexSubImage2D(tex_target, 0,
                             0, 0,
-                            full_width, full_height,
+                            width, height,
                             tex_format, tex_type, pixels);
     }
 }



More information about the vlc-commits mailing list