Revert "Revert "cogl: Pick glReadPixels format by target, not source""

This reverts commit 4f72099023.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/486
This commit is contained in:
Carlos Garnacho 2019-03-07 22:56:35 +01:00
parent 4f72099023
commit d83a325f98

View File

@ -4,6 +4,7 @@
* A Low Level GPU Graphics and Utilities API * A Low Level GPU Graphics and Utilities API
* *
* Copyright (C) 2007,2008,2009,2012 Intel Corporation. * Copyright (C) 2007,2008,2009,2012 Intel Corporation.
* Copyright (C) 2018 DisplayLink (UK) Ltd.
* *
* Permission is hereby granted, free of charge, to any person * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * 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)) if (!cogl_is_offscreen (framebuffer))
y = framebuffer_height - y - height; 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, required_format = ctx->driver_vtable->pixel_format_to_gl_with_target (ctx,
framebuffer->internal_format,
format, format,
COGL_PIXEL_FORMAT_ANY,
&gl_intformat, &gl_intformat,
&gl_format, &gl_format,
&gl_type); &gl_type);