Mesa (master): i965/brw: Fix emit_depthbuffer() when packed depth/ stencil texture is attached

Chad Versace chadversary at kemper.freedesktop.org
Fri Jun 10 18:14:53 UTC 2011


Module: Mesa
Branch: master
Commit: 97d230b0bcf8ed001f685ebac314fbd8e1955718
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=97d230b0bcf8ed001f685ebac314fbd8e1955718

Author: Chad Versace <chad at chad-versace.us>
Date:   Fri Jun 10 10:27:54 2011 -0700

i965/brw: Fix emit_depthbuffer() when packed depth/stencil texture is attached

If either depth or stencil buffer has packed depth/stencil format, then do
not use separate stencil.

Before this commit, emit_depthbuffer() incorrectly assumed that the
texture's stencil renderbuffer wrapper was a *separate* stencil buffer,
because the depth and stencil renderbuffer wrappers are distinct for
depth/stencil textures (that is, depth_irb != stencil_irb).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38134
Signed-off-by: Chad Versace <chad at chad-versace.us>

---

 src/mesa/drivers/dri/i965/brw_misc_state.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index a6de28b..3d0983e 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -220,19 +220,13 @@ static void emit_depthbuffer(struct brw_context *brw)
    unsigned int len;
 
    /*
-    * If depth and stencil buffers are identical, then don't use separate
-    * stencil.
+    * If either depth or stencil buffer has packed depth/stencil format,
+    * then don't use separate stencil. Emit only a depth buffer.
     */
-   if (depth_irb && depth_irb == stencil_irb) {
+   if (depth_irb && depth_irb->Base.Format == MESA_FORMAT_S8_Z24) {
       stencil_irb = NULL;
-   }
-
-   /*
-    * If stencil buffer uses combined depth/stencil format, but no depth buffer
-    * is attached, then use stencil buffer as depth buffer.
-    */
-   if (!depth_irb && stencil_irb
-       && stencil_irb->Base.Format == MESA_FORMAT_S8_Z24) {
+   } else if (!depth_irb && stencil_irb
+	      && stencil_irb->Base.Format == MESA_FORMAT_S8_Z24) {
       depth_irb = stencil_irb;
       stencil_irb = NULL;
    }




More information about the mesa-commit mailing list