From 24bd9780bcf400a00f6fc5a89b1648c7e3b7df07 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Aug 2010 19:34:53 -0600 Subject: st/mesa: added st_is_depth_stencil_combined() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is part of a patch by Marek Olšák. --- src/mesa/state_tracker/st_cb_fbo.c | 24 ++++++++++++++++++++++++ src/mesa/state_tracker/st_cb_fbo.h | 5 +++++ 2 files changed, 29 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 48d83ded552..71bd4729e03 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -447,6 +447,30 @@ st_validate_attachment(struct pipe_screen *screen, } +/** + * Check if two renderbuffer attachments name a combined depth/stencil + * renderbuffer. + */ +GLboolean +st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth, + const struct gl_renderbuffer_attachment *stencil) +{ + assert(depth && 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; +} + + /** * Check that the framebuffer configuration is valid in terms of what * the driver can support. diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h index 62a9bbcb25f..3e9815c1b13 100644 --- a/src/mesa/state_tracker/st_cb_fbo.h +++ b/src/mesa/state_tracker/st_cb_fbo.h @@ -88,4 +88,9 @@ st_get_renderbuffer_sampler_view(struct st_renderbuffer *rb, struct pipe_context *pipe); +extern GLboolean +st_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth, + const struct gl_renderbuffer_attachment *stencil); + + #endif /* ST_CB_FBO_H */ -- cgit v1.2.3