mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 03:20:46 -05:00
gl: Do not use deprecated constants with the GL3 driver
glGetIntegerv (GL_DEPTH_BITS, ...) and friends are deprecated in GL3; we have to use glGetFramebufferAttachmentParameteriv() instead, like we do for offscreen framebuffers. Based on a patch by: Adel Gadllah <adel.gadllah@gmail.com> Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> https://bugzilla.gnome.org/show_bug.cgi?id=753295
This commit is contained in:
parent
e7f54e6e60
commit
f20cc24292
@ -1037,27 +1037,33 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
|
|||||||
COGL_FRAMEBUFFER_STATE_BIND);
|
COGL_FRAMEBUFFER_STATE_BIND);
|
||||||
|
|
||||||
#ifdef HAVE_COGL_GL
|
#ifdef HAVE_COGL_GL
|
||||||
if (_cogl_has_private_feature
|
if ((ctx->driver == COGL_DRIVER_GL3 &&
|
||||||
(ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS) &&
|
framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) ||
|
||||||
framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN)
|
(_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS) &&
|
||||||
{
|
framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN))
|
||||||
static const struct
|
|
||||||
{
|
{
|
||||||
|
gboolean is_offscreen = framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN;
|
||||||
|
const struct {
|
||||||
GLenum attachment, pname;
|
GLenum attachment, pname;
|
||||||
size_t offset;
|
size_t offset;
|
||||||
} params[] =
|
} params[] = {
|
||||||
{
|
{ is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT,
|
||||||
{ GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
|
GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
|
||||||
offsetof (CoglFramebufferBits, red) },
|
offsetof (CoglFramebufferBits, red) },
|
||||||
{ GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
|
{ is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
|
||||||
offsetof (CoglFramebufferBits, green) },
|
offsetof (CoglFramebufferBits, green) },
|
||||||
{ GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
|
{ is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
|
||||||
offsetof (CoglFramebufferBits, blue) },
|
offsetof (CoglFramebufferBits, blue) },
|
||||||
{ GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
|
{ is_offscreen ? GL_COLOR_ATTACHMENT0 : GL_BACK_LEFT,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
|
||||||
offsetof (CoglFramebufferBits, alpha) },
|
offsetof (CoglFramebufferBits, alpha) },
|
||||||
{ GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
|
{ is_offscreen ? GL_DEPTH_ATTACHMENT : GL_DEPTH,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
|
||||||
offsetof (CoglFramebufferBits, depth) },
|
offsetof (CoglFramebufferBits, depth) },
|
||||||
{ GL_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
|
{ is_offscreen ? GL_STENCIL_ATTACHMENT : GL_STENCIL,
|
||||||
|
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
|
||||||
offsetof (CoglFramebufferBits, stencil) },
|
offsetof (CoglFramebufferBits, stencil) },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user