diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index 7ae769e4d..5a549abd3 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -65,6 +65,9 @@ #ifndef GL_DEPTH_STENCIL #define GL_DEPTH_STENCIL 0x84F9 #endif +#ifndef GL_DEPTH24_STENCIL8 +#define GL_DEPTH24_STENCIL8 0x88F0 +#endif #ifndef GL_DEPTH_ATTACHMENT #define GL_DEPTH_ATTACHMENT 0x8D00 #endif @@ -100,9 +103,10 @@ #endif typedef enum { - _TRY_DEPTH_STENCIL = 1L<<0, - _TRY_DEPTH = 1L<<1, - _TRY_STENCIL = 1L<<2 + _TRY_DEPTH_STENCIL = 1L<<0, + _TRY_DEPTH24_STENCIL8 = 1L<<1, + _TRY_DEPTH = 1L<<2, + _TRY_STENCIL = 1L<<3 } TryFBOFlags; typedef struct _CoglFramebufferStackEntry @@ -868,18 +872,21 @@ try_creating_fbo (CoglOffscreen *offscreen, tex_gl_target, tex_gl_handle, offscreen->texture_level)); - if (flags & _TRY_DEPTH_STENCIL) + if (flags & (_TRY_DEPTH_STENCIL | _TRY_DEPTH24_STENCIL8)) { + GLenum format = ((flags & _TRY_DEPTH_STENCIL) ? + GL_DEPTH_STENCIL : GL_DEPTH24_STENCIL8); + /* Create a renderbuffer for depth and stenciling */ GE (ctx, glGenRenderbuffers (1, &gl_depth_stencil_handle)); GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, gl_depth_stencil_handle)); if (n_samples) GE (ctx, glRenderbufferStorageMultisampleIMG (GL_RENDERBUFFER, n_samples, - GL_DEPTH_STENCIL, + format, width, height)); else - GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_STENCIL, + GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format, width, height)); GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0)); GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER, @@ -1009,6 +1016,9 @@ _cogl_offscreen_allocate (CoglOffscreen *offscreen, ((ctx->private_feature_flags & COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) && try_creating_fbo (offscreen, flags = _TRY_DEPTH_STENCIL)) || + ((ctx->private_feature_flags & + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL) && + try_creating_fbo (offscreen, flags = _TRY_DEPTH24_STENCIL8)) || try_creating_fbo (offscreen, flags = _TRY_DEPTH | _TRY_STENCIL) || try_creating_fbo (offscreen, flags = _TRY_STENCIL) || try_creating_fbo (offscreen, flags = _TRY_DEPTH) || diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h index b42c6c731..0cc2f9bec 100644 --- a/cogl/cogl-internal.h +++ b/cogl/cogl-internal.h @@ -106,7 +106,8 @@ typedef enum COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4, COGL_PRIVATE_FEATURE_PBOS = 1L<<5, COGL_PRIVATE_FEATURE_VBOS = 1L<<6, - COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL = 1L<<7 + COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL = 1L<<7, + COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL = 1L<<8 } CoglPrivateFeatureFlags; /* Sometimes when evaluating pipelines, either during comparisons or diff --git a/cogl/driver/gles/cogl-gles.c b/cogl/driver/gles/cogl-gles.c index 9001a0489..2afdbebde 100644 --- a/cogl/driver/gles/cogl-gles.c +++ b/cogl/driver/gles/cogl-gles.c @@ -162,6 +162,9 @@ _cogl_gles_update_features (CoglContext *context, if (context->glEGLImageTargetTexture2D) private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE; + if (_cogl_check_extension ("GL_OES_packed_depth_stencil", gl_extensions)) + private_flags |= COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL; + /* Cache features */ context->private_feature_flags |= private_flags; context->feature_flags |= flags;