[Cogl] [PATCH 2/3] Use the GL_DEPTH24_STENCIL8 internal format for packed buffers
Damien Lespiau
damien.lespiau at gmail.com
Wed May 23 10:23:46 PDT 2012
From: Damien Lespiau <damien.lespiau at intel.com>
GL_DEPTH_STENCIL is not a valid internal format according to
EXT_packed_depth_stencil. Let's use the the GL_DEPTH24_STENCIL8 internal
format defined by the extension (internal format also used by the OES
code path).
I've noticed this when trying to create a texture with this format as
internal format and it did not pass the GL_PROXY_TEXTURE_2D test.
glRenderBufferStorage() uses internal formats as well, so changing it to
GL_DEPTH24_STENCIL8 seemed like the natural thing to do.
---
cogl/cogl-framebuffer.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index e9bde6a..30613f7 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -111,10 +111,9 @@
typedef enum {
- _TRY_DEPTH_STENCIL = 1L<<0,
- _TRY_DEPTH24_STENCIL8 = 1L<<1,
- _TRY_DEPTH = 1L<<2,
- _TRY_STENCIL = 1L<<3
+ _TRY_DEPTH24_STENCIL8 = 1L<<0,
+ _TRY_DEPTH = 1L<<1,
+ _TRY_STENCIL = 1L<<2
} TryFBOFlags;
typedef struct _CoglFramebufferStackEntry
@@ -880,21 +879,18 @@ try_creating_fbo (CoglOffscreen *offscreen,
tex_gl_target, tex_gl_handle,
offscreen->texture_level));
- if (flags & (_TRY_DEPTH_STENCIL | _TRY_DEPTH24_STENCIL8))
+ if (flags & _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,
- format,
+ GL_DEPTH24_STENCIL8,
width, height));
else
- GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, format,
+ GE (ctx, glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH24_STENCIL8,
width, height));
GE (ctx, glBindRenderbuffer (GL_RENDERBUFFER, 0));
GE (ctx, glFramebufferRenderbuffer (GL_FRAMEBUFFER,
@@ -1023,7 +1019,7 @@ _cogl_offscreen_allocate (CoglOffscreen *offscreen,
try_creating_fbo (offscreen, flags)) ||
((ctx->private_feature_flags &
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) &&
- try_creating_fbo (offscreen, flags = _TRY_DEPTH_STENCIL)) ||
+ try_creating_fbo (offscreen, flags = _TRY_DEPTH24_STENCIL8)) ||
((ctx->private_feature_flags &
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL) &&
try_creating_fbo (offscreen, flags = _TRY_DEPTH24_STENCIL8)) ||
--
1.7.7.5
More information about the Cogl
mailing list