i965/wm: Program correct conservative depth modes
authorChris Forbes <chrisf@ijw.co.nz>
Sat, 5 Oct 2013 08:39:25 +0000 (21:39 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 5 Oct 2013 22:05:10 +0000 (11:05 +1300)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/gen7_wm_state.c

index 80073cdf0e46d7b53d0579dca6c16e9f701574ae..7ddeb6ec0a2b15740e8ebb5e70bdc60fb5a700ea 100644 (file)
@@ -60,8 +60,20 @@ upload_wm_state(struct brw_context *brw)
    if (fp->program.Base.InputsRead & VARYING_BIT_POS)
       dw1 |= GEN7_WM_USES_SOURCE_DEPTH | GEN7_WM_USES_SOURCE_W;
    if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
-      writes_depth = true;
-      dw1 |= GEN7_WM_PSCDEPTH_ON;
+      writes_depth = fp->program.FragDepthLayout != FRAG_DEPTH_LAYOUT_UNCHANGED;
+
+      switch (fp->program.FragDepthLayout) {
+         case FRAG_DEPTH_LAYOUT_NONE:
+         case FRAG_DEPTH_LAYOUT_ANY:
+            dw1 |= GEN7_WM_PSCDEPTH_ON;
+            break;
+         case FRAG_DEPTH_LAYOUT_GREATER:
+            dw1 |= GEN7_WM_PSCDEPTH_ON_GE;
+            break;
+         case FRAG_DEPTH_LAYOUT_LESS:
+            dw1 |= GEN7_WM_PSCDEPTH_ON_LE;
+            break;
+      }
    }
    /* CACHE_NEW_WM_PROG */
    dw1 |= brw->wm.prog_data->barycentric_interp_modes <<