From 84d83f5bf8c2973c612b134d22492183f326ae74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Mon, 22 Jul 2024 18:21:12 +0200 Subject: [PATCH] gl-renderer: Assume default GL_PACK_ALIGNMENT state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to default value right after use so that other part of the code can assume the default state. Signed-off-by: Loïc Molinari --- libweston/renderer-gl/gl-renderer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index b71df8b6..4aa1ca78 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -737,8 +737,6 @@ gl_renderer_do_read_pixels(struct gl_renderer *gr, assert(fmt->gl_type != 0); assert(fmt->gl_format != 0); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - if (!is_y_flipped(go)) { glReadPixels(rect->x, rect->y, rect->width, rect->height, fmt->gl_format, fmt->gl_type, pixels); @@ -947,7 +945,6 @@ gl_renderer_do_read_pixels_async(struct gl_renderer *gr, assert(fmt->gl_type != 0); assert(fmt->gl_format != 0); - glPixelStorei(GL_PACK_ALIGNMENT, 4); if (gr->has_pack_reverse && is_y_flipped(go)) glPixelStorei(GL_PACK_REVERSE_ROW_ORDER_ANGLE, GL_TRUE); @@ -2498,6 +2495,7 @@ gl_renderer_read_pixels(struct weston_output *output, glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(x, y, width, height, format->gl_format, format->gl_type, pixels); + glPixelStorei(GL_PACK_ALIGNMENT, 4); return 0; } @@ -3707,7 +3705,6 @@ gl_renderer_surface_copy_content(struct weston_surface *surface, .input_tex_filter = GL_NEAREST, }; const pixman_format_code_t format = PIXMAN_a8b8g8r8; - const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */ const GLenum gl_format = GL_RGBA; /* PIXMAN_a8b8g8r8 little-endian */ struct gl_renderer *gr = get_renderer(surface->compositor); struct gl_surface_state *gs; @@ -3781,7 +3778,6 @@ gl_renderer_surface_copy_content(struct weston_surface *surface, glDisableVertexAttribArray(SHADER_ATTRIB_LOC_TEXCOORD); glDisableVertexAttribArray(SHADER_ATTRIB_LOC_POSITION); - glPixelStorei(GL_PACK_ALIGNMENT, bytespp); glReadPixels(src_x, src_y, width, height, gl_format, GL_UNSIGNED_BYTE, target); ret = 0;