Commit 06c1f879 authored by Martin Storsjö's avatar Martin Storsjö

opengl: Do subtexture uploads only for the visible area

This avoids doing the intermediate copy in some cases.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 3943ba9e
......@@ -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);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment