From d83a325f98c8a6fa346a924192e65cf7a3c87c81 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 7 Mar 2019 22:56:35 +0100 Subject: [PATCH] Revert "Revert "cogl: Pick glReadPixels format by target, not source"" This reverts commit 4f72099023bc5bb142a782a1924797729329cc9a. https://gitlab.gnome.org/GNOME/mutter/merge_requests/486 --- cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 84c2f314a..c2bf92882 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -4,6 +4,7 @@ * A Low Level GPU Graphics and Utilities API * * Copyright (C) 2007,2008,2009,2012 Intel Corporation. + * Copyright (C) 2018 DisplayLink (UK) Ltd. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -1273,9 +1274,12 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, if (!cogl_is_offscreen (framebuffer)) y = framebuffer_height - y - height; + /* Use target format ANY, because GL texture_swizzle extension cannot + * ever apply for glReadPixels. + */ required_format = ctx->driver_vtable->pixel_format_to_gl_with_target (ctx, - framebuffer->internal_format, format, + COGL_PIXEL_FORMAT_ANY, &gl_intformat, &gl_format, &gl_type);