[gtk/wip/otte/gles: 2/3] gl: Make sure to set a proper alignment
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/gles: 2/3] gl: Make sure to set a proper alignment
- Date: Sat, 9 Oct 2021 03:25:50 +0000 (UTC)
commit d4959a95c21e20da530a0358f81049e13623d866
Author: Benjamin Otte <otte redhat com>
Date: Sat Oct 9 05:25:05 2021 +0200
gl: Make sure to set a proper alignment
No matter which branch we take, the alignment setting is always the
same.
gdk/gdkglcontext.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 196e5fce4d..f719da3aea 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -298,15 +298,14 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
bpp = gdk_memory_format_bytes_per_pixel (data_format);
+ glPixelStorei (GL_UNPACK_ALIGNMENT, gdk_memory_format_alignment (data_format));
+
/* GL_UNPACK_ROW_LENGTH is available on desktop GL, OpenGL ES >= 3.0, or if
* the GL_EXT_unpack_subimage extension for OpenGL ES 2.0 is available
*/
if (stride == width * bpp)
{
- glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
-
glTexImage2D (texture_target, 0, gl_internalformat, width, height, 0, gl_format, gl_type, data);
- glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
}
else if (stride % bpp == 0 &&
(!gdk_gl_context_get_use_es (context) ||
@@ -325,6 +324,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
for (i = 0; i < height; i++)
glTexSubImage2D (texture_target, 0, 0, i, width, 1, gl_format, gl_type, data + (i * stride));
}
+ glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
g_free (copy);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]