cogl: Only do the swizzling hack for GL contexts

The GL_BGRA definition is not available for GLES2 contexts, which use
the EXT_texture_format_BGRA8888 instead, causing a build failure when
trying to use it in those contexts.

Fortunately, this hack is only relevant for GL, so let's guard it to
prevent the failure in GLES2, where that extension is used instead.

https://bugzilla.gnome.org/show_bug.cgi?id=786568
This commit is contained in:
Mario Sanchez Prada 2017-08-21 13:29:25 +02:00
parent 14fe6e9c95
commit 483ed98777

View File

@ -1417,15 +1417,17 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
&gl_intformat, &gl_intformat,
&gl_format, &gl_format,
&gl_type); &gl_type);
#if HAVE_COGL_GL
/* As we are reading pixels, we want to consider the bitmap according to /* As we are reading pixels, we want to consider the bitmap according to
* its real pixel format, not the swizzled channels we pretend face to the * its real pixel format, not the swizzled channels we pretend face to the
* pipeline. * pipeline.
*/ */
if ((format == COGL_PIXEL_FORMAT_BGRA_8888 || if ((ctx->driver == COGL_DRIVER_GL || ctx->driver == COGL_DRIVER_GL3) &&
(format == COGL_PIXEL_FORMAT_BGRA_8888 ||
format == COGL_PIXEL_FORMAT_BGRA_8888_PRE) && format == COGL_PIXEL_FORMAT_BGRA_8888_PRE) &&
_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE)) _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
gl_format = GL_BGRA; gl_format = GL_BGRA;
#endif
/* NB: All offscreen rendering is done upside down so there is no need /* NB: All offscreen rendering is done upside down so there is no need
* to flip in this case... */ * to flip in this case... */