Revert "r300g: fix occlusion queries when depth test is disabled or zbuffer is missing"
authorMarek Olšák <maraeo@gmail.com>
Sun, 2 Dec 2012 03:40:36 +0000 (04:40 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sun, 2 Dec 2012 06:07:33 +0000 (07:07 +0100)
It broke Hyper-Z terribly.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c

index 1da6044eb87f21d91e9ecfad2da330b6e2303ec1..8d9d338623985a8fbede721af17b8004a6488e33 100644 (file)
@@ -441,19 +441,6 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
             OUT_CS_REG(R300_ZB_ZMASK_OFFSET, 0);
             OUT_CS_REG(R300_ZB_ZMASK_PITCH, surf->pitch_zmask);
         }
-    /* Set up a dummy zbuffer. Otherwise occlusion queries won't work.
-     * Use the first colorbuffer, we will disable writes in the DSA state
-     * so as not to corrupt it. */
-    } else if (fb->nr_cbufs) {
-        surf = r300_surface(fb->cbufs[0]);
-
-        OUT_CS_REG(R300_ZB_FORMAT, R300_DEPTHFORMAT_16BIT_INT_Z);
-
-        OUT_CS_REG(R300_ZB_DEPTHOFFSET, 0);
-        OUT_CS_RELOC(surf);
-
-        OUT_CS_REG(R300_ZB_DEPTHPITCH, 4 | R300_DEPTHMICROTILE_TILED_SQUARE);
-        OUT_CS_RELOC(surf);
     }
 
     END_CS;
index e5e68d22dd05e4b4a3a4c872ec7463f29f533502..02a263eabda961eb6239f6304a4af1f335d5c199 100644 (file)
@@ -578,10 +578,6 @@ static void*
         dsa->z_stencil_control |=
             (r300_translate_depth_stencil_function(state->depth.func) <<
                 R300_Z_FUNC_SHIFT);
-    } else {
-        /* We must enable depth test, otherwise occlusion queries won't work. */
-        dsa->z_buffer_control |= R300_Z_ENABLE;
-        dsa->z_stencil_control |= R300_ZS_ALWAYS;
     }
 
     /* Stencil buffer setup. */
@@ -665,13 +661,11 @@ static void*
     OUT_CB_REG(R500_FG_ALPHA_VALUE, dsa->alpha_value);
     END_CB;
 
-    /* We must enable depth test, otherwise occlusion queries won't work.
-     * We setup a dummy zbuffer to silent the CS checker, see emit_fb_state. */
     BEGIN_CB(dsa->cb_zb_no_readwrite, 10);
     OUT_CB_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
     OUT_CB_REG_SEQ(R300_ZB_CNTL, 3);
-    OUT_CB(R300_Z_ENABLE);
-    OUT_CB(R300_ZS_ALWAYS);
+    OUT_CB(0);
+    OUT_CB(0);
     OUT_CB(0);
     OUT_CB_REG(R500_ZB_STENCILREFMASK_BF, 0);
     OUT_CB_REG(R500_FG_ALPHA_VALUE, dsa->alpha_value);
@@ -680,8 +674,8 @@ static void*
     BEGIN_CB(dsa->cb_fp16_zb_no_readwrite, 10);
     OUT_CB_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function_fp16);
     OUT_CB_REG_SEQ(R300_ZB_CNTL, 3);
-    OUT_CB(R300_Z_ENABLE);
-    OUT_CB(R300_ZS_ALWAYS);
+    OUT_CB(0);
+    OUT_CB(0);
     OUT_CB(0);
     OUT_CB_REG(R500_ZB_STENCILREFMASK_BF, 0);
     OUT_CB_REG(R500_FG_ALPHA_VALUE, dsa->alpha_value);
@@ -827,14 +821,12 @@ void r300_mark_fb_state_dirty(struct r300_context *r300,
     /* Now compute the fb_state atom size. */
     r300->fb_state.size = 2 + (8 * state->nr_cbufs);
 
-    if (r300->cbzb_clear) {
+    if (r300->cbzb_clear)
         r300->fb_state.size += 10;
-    else if (state->zsbuf) {
+    else if (state->zsbuf) {
         r300->fb_state.size += 10;
         if (r300->hyperz_enabled)
             r300->fb_state.size += 8;
-    } else if (state->nr_cbufs) {
-        r300->fb_state.size += 10;
     }
 
     /* The size of the rest of atoms stays the same. */