[gtk/wip/otte/gles: 1/3] gl: Check the stride is a multiple of the bpp




commit 780ae5232dc24d37a70e1ae57a4e58d108af9d17
Author: Benjamin Otte <otte redhat com>
Date:   Sat Oct 9 05:24:44 2021 +0200

    gl: Check the stride is a multiple of the bpp

 gdk/gdkglcontext.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index b1984d57b8..196e5fce4d 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -308,7 +308,8 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
       glTexImage2D (texture_target, 0, gl_internalformat, width, height, 0, gl_format, gl_type, data);
       glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
     }
-  else if ((!gdk_gl_context_get_use_es (context) ||
+  else if (stride % bpp == 0 &&
+           (!gdk_gl_context_get_use_es (context) ||
             (priv->gl_version >= 30 || priv->has_unpack_subimage)))
     {
       glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]