r300g: Move ztop to derived state.
[mesa.git] / src / gallium / drivers / r300 / r300_state_invariant.c
index e438114010c784f8dd02b3f2e2f28ead745294e0..3865730d635cfef71354eb38f609f5428ffa6ed9 100644 (file)
 
 #include "r300_state_invariant.h"
 
+
+struct pipe_viewport_state r300_viewport_identity = {
+    .scale = {1.0, 1.0, 1.0, 1.0},
+    .translate = {0.0, 0.0, 0.0, 0.0},
+};
+
 /* Calculate and emit invariant state. This is data that the 3D engine
  * will probably want at the beginning of every CS, but it's not currently
  * handled by any CSO setup, and in addition it doesn't really change much.
@@ -34,14 +40,19 @@ void r300_emit_invariant_state(struct r300_context* r300)
     struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps;
     CS_LOCALS(r300);
 
-    BEGIN_CS(26 + (caps->has_tcl ? 2: 0));
+    BEGIN_CS(24 + (caps->has_tcl ? 2: 0));
 
     /*** Graphics Backend (GB) ***/
     /* Various GB enables */
-    OUT_CS_REG(R300_GB_ENABLE, 0x0);
-    /* Subpixel multisampling for AA */
-    OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
-    OUT_CS_REG(R300_GB_MSPOS1, 0x6666666);
+    OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
+                               R300_GB_LINE_STUFF_ENABLE  |
+                               R300_GB_TRIANGLE_STUFF_ENABLE);
+    /* Subpixel multisampling for AA
+     * These are commented out because glisse's CS checker doesn't like them.
+     * I presume these will be re-enabled later.
+     * OUT_CS_REG(R300_GB_MSPOS0, 0x66666666);
+     * OUT_CS_REG(R300_GB_MSPOS1, 0x6666666);
+     */
     /* Source of fog depth */
     OUT_CS_REG(R300_GB_SELECT, R300_GB_FOG_SELECT_1_1_W);
     /* AA enable */
@@ -53,6 +64,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
     OUT_CS_REG(R300_FG_FOG_COLOR_G, 0x0);
     OUT_CS_REG(R300_FG_FOG_COLOR_B, 0x0);
     OUT_CS_REG(R300_FG_DEPTH_SRC, 0x0);
+    OUT_CS_REG(R300_US_W_FMT, 0x0);
 
     /*** VAP ***/
     /* Max and min vertex index clamp. */
@@ -69,7 +81,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
     END_CS;
 
     /* XXX unsorted stuff from surface_fill */
-    BEGIN_CS(77 + (caps->has_tcl ? 5 : 0));
+    BEGIN_CS(64 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0));
     /* Flush PVS. */
     OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
 
@@ -77,17 +89,12 @@ void r300_emit_invariant_state(struct r300_context* r300)
         R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA |
         R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA |
         R300_VPORT_Z_OFFSET_ENA | R300_VTX_W0_FMT);
-    /* XXX endian */
     if (caps->has_tcl) {
-        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP);
         OUT_CS_REG_SEQ(R300_VAP_GB_VERT_CLIP_ADJ, 4);
         OUT_CS_32F(1.0);
         OUT_CS_32F(1.0);
         OUT_CS_32F(1.0);
         OUT_CS_32F(1.0);
-    } else {
-        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VC_NO_SWAP |
-                R300_VAP_TCL_BYPASS);
     }
     /* XXX point tex stuffing */
     OUT_CS_REG_SEQ(R300_GA_POINT_S0, 1);
@@ -117,8 +124,10 @@ void r300_emit_invariant_state(struct r300_context* r300)
     OUT_CS_REG(R300_RB3D_CCTL, 0x00000000);
     OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F);
     OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000);
-    OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000);
-    OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFFFFFFFF);
+    if (caps->is_r500) {
+        OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000);
+        OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD, 0xFFFFFFFF);
+    }
     OUT_CS_REG(R300_ZB_FORMAT, 0x00000002);
     OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, 0x00000003);
     OUT_CS_REG(R300_ZB_BW_CNTL, 0x00000000);
@@ -132,11 +141,5 @@ void r300_emit_invariant_state(struct r300_context* r300)
     /* XXX */
     OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
 
-    OUT_CS_REG_SEQ(R300_US_OUT_FMT_0, 4);
-    OUT_CS(R300_C0_SEL_B | R300_C1_SEL_G | R300_C2_SEL_R | R300_C3_SEL_A);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS(R300_US_OUT_FMT_UNUSED);
-    OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0);
     END_CS;
 }