i965/brw: Fix emit_depthbuffer() when packed depth/stencil texture is attached
[mesa.git] / src / mesa / drivers / dri / i965 / brw_misc_state.c
index a6de28b3addbdc42409f8d3c2121ea993cda4f37..3d0983e68798343c14865a996b8ca94215dbff27 100644 (file)
@@ -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;
    }