From f8855a42141cc76cf6954eee2af80e7dbc932c85 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 14 Mar 2013 14:22:56 +0100 Subject: mesa: add helper func for checking combined depthstencil buffers from st/mesa Reviewed-by: Brian Paul Tested-by: Brian Paul --- src/mesa/main/fbobject.c | 26 ++++++++++++++++++++++++++ src/mesa/main/fbobject.h | 3 +++ 2 files changed, 29 insertions(+) (limited to 'src/mesa/main') 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 @@ -473,6 +473,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. */ 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); -- cgit v1.2.3