i965/brw: Fix emit_depthbuffer() when packed depth/stencil texture is attached
[mesa.git] / src / mesa / drivers / dri / i965 / brw_misc_state.c
index 4256234a645ebcf1a87461e7c51147a4a13e2447..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;
    }
@@ -606,13 +600,15 @@ static void upload_invarient_state( struct brw_context *brw )
       OUT_BATCH(1);
       ADVANCE_BATCH();
 
-      for (i = 0; i < 4; i++) {
-        BEGIN_BATCH(4);
-        OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
-        OUT_BATCH(i << SVB_INDEX_SHIFT);
-        OUT_BATCH(0);
-        OUT_BATCH(0xffffffff);
-        ADVANCE_BATCH();
+      if (intel->gen < 7) {
+        for (i = 0; i < 4; i++) {
+           BEGIN_BATCH(4);
+           OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2));
+           OUT_BATCH(i << SVB_INDEX_SHIFT);
+           OUT_BATCH(0);
+           OUT_BATCH(0xffffffff);
+           ADVANCE_BATCH();
+        }
       }
    }