Mesa (master): intel: Change FBO validation criteria to accomodate hiz and seprate stencil
Chad Versace
chadversary at kemper.freedesktop.org
Wed May 25 14:44:46 UTC 2011
Module: Mesa
Branch: master
Commit: e7bcfadc2255e3417e03676837d248f4976419e2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7bcfadc2255e3417e03676837d248f4976419e2
Author: Chad Versace <chad at chad-versace.us>
Date: Mon May 23 13:48:18 2011 -0700
intel: Change FBO validation criteria to accomodate hiz and seprate stencil
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
src/mesa/drivers/dri/intel/intel_fbo.c | 42 ++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 18675ab..7434e0e 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -665,21 +665,33 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
intel_get_renderbuffer(fb, BUFFER_STENCIL);
int i;
- if (depthRb && stencilRb && stencilRb != depthRb) {
- if (fb->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE &&
- fb->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE &&
- (fb->Attachment[BUFFER_DEPTH].Texture->Name ==
- fb->Attachment[BUFFER_STENCIL].Texture->Name)) {
- /* OK */
- } else {
- /* we only support combined depth/stencil buffers, not separate
- * stencil buffers.
- */
- DBG("Only supports combined depth/stencil (found %s, %s)\n",
- depthRb ? _mesa_get_format_name(depthRb->Base.Format): "NULL",
- stencilRb ? _mesa_get_format_name(stencilRb->Base.Format): "NULL");
- fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
- }
+ /*
+ * The depth and stencil renderbuffers are the same renderbuffer or wrap
+ * the same texture.
+ */
+ bool depth_stencil_are_same;
+ if (depthRb && stencilRb && depthRb == stencilRb)
+ depth_stencil_are_same = true;
+ else if (depthRb && stencilRb && depthRb != stencilRb
+ && (fb->Attachment[BUFFER_DEPTH].Type == GL_TEXTURE)
+ && (fb->Attachment[BUFFER_STENCIL].Type == GL_TEXTURE)
+ && (fb->Attachment[BUFFER_DEPTH].Texture->Name
+ == fb->Attachment[BUFFER_STENCIL].Texture->Name))
+ depth_stencil_are_same = true;
+ else
+ depth_stencil_are_same = false;
+
+ bool fb_has_combined_depth_stencil_format =
+ (depthRb && depthRb->Base.Format == MESA_FORMAT_S8_Z24) ||
+ (stencilRb && stencilRb->Base.Format == MESA_FORMAT_S8_Z24);
+
+ bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
+
+ if ((intel->must_use_separate_stencil || fb_has_hiz)
+ && (depth_stencil_are_same || fb_has_combined_depth_stencil_format)) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
+ } else if (!intel->has_separate_stencil && depthRb && stencilRb && !depth_stencil_are_same) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
}
for (i = 0; i < Elements(fb->Attachment); i++) {
More information about the mesa-commit
mailing list