diff options
author | Marek Olšák <[email protected]> | 2013-03-14 14:22:56 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-03-23 13:17:05 +0100 |
commit | f8855a42141cc76cf6954eee2af80e7dbc932c85 (patch) | |
tree | 24bc13461bb89755708ca6f7fcfe59642a76180f /src/mesa/main | |
parent | 2dc2066b90581ae3878ef7846f961bcb5bd07651 (diff) |
mesa: add helper func for checking combined depthstencil buffers from st/mesa
Reviewed-by: Brian Paul <[email protected]>
Tested-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/fbobject.c | 26 | ||||
-rw-r--r-- | src/mesa/main/fbobject.h | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 0126e293051..d7e15e1ce6c 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -474,6 +474,32 @@ _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) /** + * Return true if the framebuffer has a combined depth/stencil + * renderbuffer attached. + */ +GLboolean +_mesa_has_depthstencil_combined(const struct gl_framebuffer *fb) +{ + const struct gl_renderbuffer_attachment *depth = + &fb->Attachment[BUFFER_DEPTH]; + const struct gl_renderbuffer_attachment *stencil = + &fb->Attachment[BUFFER_STENCIL]; + + if (depth->Type == stencil->Type) { + if (depth->Type == GL_RENDERBUFFER_EXT && + depth->Renderbuffer == stencil->Renderbuffer) + return GL_TRUE; + + if (depth->Type == GL_TEXTURE && + depth->Texture == stencil->Texture) + return GL_TRUE; + } + + return GL_FALSE; +} + + +/** * For debug only. */ static void diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index ec8b0afe410..0358864d798 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -113,6 +113,9 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, extern void _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb); +extern GLboolean +_mesa_has_depthstencil_combined(const struct gl_framebuffer *fb); + extern void _mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb); |