[vlc-commits] opengl: converter_sw: reset UNPACK_ROW_LENGTH after usage

Louis Segretin git at videolan.org
Mon Dec 9 17:46:01 CET 2019


vlc/vlc-3.0 | branch: master | Louis Segretin <lsegretin.contrib at gmail.com> | Wed Dec  4 18:09:45 2019 +0100| [4645155985d3f6bef2b31110a5fea8e5291216c4] | committer: Thomas Guillem

opengl: converter_sw: reset UNPACK_ROW_LENGTH after usage

Some drivers seem to use this value for glTexSubImage2D even with
GL_PIXEL_UNPACK_BUFFER set to 0. As the rest of the code is not
UNPACK_ROW_LENGTH aware, it is safer to reset it to a non-active value.

For example, this would cause glitches if pictures were uploaded with
this extension but SPU were not, or more generally if another client of
the OpenGL context is updating some textures by itself outside of the
OpenGL renderer.

Looks really close to an OpenGL version of #22267.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4645155985d3f6bef2b31110a5fea8e5291216c4
---

 modules/video_output/opengl/converter_sw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/video_output/opengl/converter_sw.c b/modules/video_output/opengl/converter_sw.c
index 4e510bcd07..5d91be7c84 100644
--- a/modules/video_output/opengl/converter_sw.c
+++ b/modules/video_output/opengl/converter_sw.c
@@ -238,6 +238,8 @@ tc_pbo_update(const opengl_tex_converter_t *tc, GLuint *textures,
 
         tc->vt->TexSubImage2D(tc->tex_target, 0, 0, 0, tex_width[i], tex_height[i],
                               tc->texs[i].format, tc->texs[i].type, NULL);
+
+        tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
     }
 
     /* turn off pbo */
@@ -496,6 +498,7 @@ upload_plane(const opengl_tex_converter_t *tc, unsigned tex_idx,
         tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, pitch * width / (visible_pitch ?: 1));
         tc->vt->TexSubImage2D(tc->tex_target, 0, 0, 0, width, height,
                               tex_format, tex_type, pixels);
+        tc->vt->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
     }
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list