diff options
author | Chad Versace <[email protected]> | 2011-05-23 13:48:18 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2011-05-25 07:41:32 -0700 |
commit | e7bcfadc2255e3417e03676837d248f4976419e2 (patch) | |
tree | aa3cd7a48a8ba084b25f8741ba72d4ca8d744551 /src/mesa/drivers | |
parent | ce8fdf666fc14aa5b9672be1711dfc1c0039efd0 (diff) |
intel: Change FBO validation criteria to accomodate hiz and seprate stencil
Reviewed-by: Eric Anholt <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | 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 18675ab16a5..7434e0efff6 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++) { |