r300g: Move ZTOP to its own state atom.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Thu, 15 Oct 2009 03:06:38 +0000 (20:06 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Thu, 15 Oct 2009 03:06:38 +0000 (20:06 -0700)
It may seem pointless, but this avoids a fair amount of predicted CSO pain.

src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_surface.h

index d2e88755037118299dea4a5cc4cea44beca8c695..2acce0fd4a45eb4d64f4170f29f9487419b32c17 100644 (file)
@@ -62,7 +62,6 @@ struct r300_dsa_state {
     uint32_t z_buffer_control;  /* R300_ZB_CNTL: 0x4f00 */
     uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */
     uint32_t stencil_ref_mask;  /* R300_ZB_STENCILREFMASK: 0x4f08 */
-    uint32_t z_buffer_top;      /* R300_ZB_ZTOP: 0x4f14 */
     uint32_t stencil_ref_bf;    /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */
 };
 
@@ -124,6 +123,10 @@ struct r300_viewport_state {
     uint32_t vte_control; /* R300_VAP_VTE_CNTL:      0x20b0 */
 };
 
+struct r300_ztop_state {
+    uint32_t z_buffer_top;      /* R300_ZB_ZTOP: 0x4f14 */
+};
+
 #define R300_NEW_BLEND           0x00000001
 #define R300_NEW_BLEND_COLOR     0x00000002
 #define R300_NEW_CLIP            0x00000004
@@ -281,6 +284,9 @@ struct r300_context {
     struct r300_vertex_shader* vs;
     /* Viewport state. */
     struct r300_viewport_state* viewport_state;
+    /* ZTOP state. */
+    struct r300_ztop_state ztop_state;
+
     /* Bitmask of dirty state objects. */
     uint32_t dirty_state;
     /* Flag indicating whether or not the HW is dirty. */
index feffadd0ee80ff07d2a19dbf9029030bc905a417..2c3bba952d80070603736249ad0e3500d8ec16a5 100644 (file)
@@ -106,7 +106,7 @@ void r300_emit_dsa_state(struct r300_context* r300,
     OUT_CS(dsa->z_buffer_control);
     OUT_CS(dsa->z_stencil_control);
     OUT_CS(dsa->stencil_ref_mask);
-    OUT_CS_REG(R300_ZB_ZTOP, dsa->z_buffer_top);
+    OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top);
     if (r300screen->caps->is_r500) {
         /* OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); */
     }
index 5d323a26b143090768fc07833a2b750bc24b60fd..f0861a9cf1d5efa681431c1b67603f48a1f6543e 100644 (file)
@@ -446,7 +446,7 @@ static void r300_update_rs_block(struct r300_context* r300)
 
 static void r300_update_ztop(struct r300_context* r300)
 {
-    r300->dsa_state->z_buffer_top = R300_ZTOP_ENABLE;
+    r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE;
 
     /* This is important enough that I felt it warranted a comment.
      *
@@ -467,11 +467,11 @@ static void r300_update_ztop(struct r300_context* r300)
      * ~C.
      */
     if (r300->dsa_state->alpha_function) {
-        r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE;
+        r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
     } else if (r300_fragment_shader_writes_depth(r300->fs)) {
-        r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE;
+        r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
     } else if (r300->query_current) {
-        r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE;
+        r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE;
     }
 }
 
index f9e98b2ec9c473410146c965b884354e4446b54f..d5998e6e6da2ea29e0629342620b83c220131c86 100644 (file)
@@ -54,7 +54,6 @@ static struct r300_dsa_state dsa_clear_state = {
     .z_buffer_control = 0x0,
     .z_stencil_control = 0x0,
     .stencil_ref_mask = R300_STENCILWRITEMASK_MASK,
-    .z_buffer_top = R300_ZTOP_ENABLE,
     .stencil_ref_bf = 0x0,
 };