r300g: Move TCL bypass switch to main context.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 11 Jan 2010 06:32:58 +0000 (22:32 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 11 Jan 2010 07:15:05 +0000 (23:15 -0800)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c

index 70b381fe74bc0ec2bd2ca1ed5041d9379904431c..05ea7ad0f90edcff7c11dac936f503fef6a5117f 100644 (file)
@@ -71,11 +71,6 @@ struct r300_rs_state {
     /* Draw-specific rasterizer state */
     struct pipe_rasterizer_state rs;
 
-    /* Whether or not to enable the VTE. This is referenced at the very
-     * last moment during emission of VTE state, to decide whether or not
-     * the VTE should be used for transformation. */
-    boolean enable_vte;
-
     uint32_t vap_control_status;    /* R300_VAP_CNTL_STATUS: 0x2140 */
     uint32_t point_size;            /* R300_GA_POINT_SIZE: 0x421c */
     uint32_t point_minmax;          /* R300_GA_POINT_MINMAX: 0x4230 */
@@ -322,6 +317,8 @@ struct r300_context {
     uint32_t dirty_state;
     /* Flag indicating whether or not the HW is dirty. */
     uint32_t dirty_hw;
+    /* Whether the TCL engine should be in bypass mode. */
+    boolean tcl_bypass;
 
     /** Combination of DBG_xxx flags */
     unsigned debug;
index aa21682e4b37ac011468b02e23abac5f38bd3825..86d4000d086b700e2a65aaa7b4a13bbc3283f3ab 100644 (file)
@@ -147,7 +147,6 @@ static const float * get_shader_constant(
 {
     struct r300_viewport_state* viewport =
         (struct r300_viewport_state*)r300->viewport_state.state;
-    boolean vte_enabled = viewport->vte_control & ~R300_VTX_W0_FMT;
     static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
     struct pipe_texture *tex;
 
@@ -176,25 +175,22 @@ static const float * get_shader_constant(
                     break;
 
                 case RC_STATE_R300_VIEWPORT_SCALE:
-                /* XXX argfl stop crossing state */
-                    if (vte_enabled) {
-                        vec[0] = viewport->xscale;
-                        vec[1] = viewport->yscale;
-                        vec[2] = viewport->zscale;
-                    } else {
+                    if (r300->tcl_bypass) {
                         vec[0] = 1;
                         vec[1] = 1;
                         vec[2] = 1;
+                    } else {
+                        vec[0] = viewport->xscale;
+                        vec[1] = viewport->yscale;
+                        vec[2] = viewport->zscale;
                     }
                     break;
 
                 case RC_STATE_R300_VIEWPORT_OFFSET:
-                    if (vte_enabled) {
+                    if (!r300->tcl_bypass) {
                         vec[0] = viewport->xoffset;
                         vec[1] = viewport->yoffset;
                         vec[2] = viewport->zoffset;
-                    } else {
-                        /* Zeros. */
                     }
                     break;
 
@@ -923,22 +919,22 @@ void r300_emit_viewport_state(struct r300_context* r300, void* state)
     struct r300_viewport_state* viewport = (struct r300_viewport_state*)state;
     CS_LOCALS(r300);
 
-    BEGIN_CS(9);
-    OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
-    OUT_CS_32F(viewport->xscale);
-    OUT_CS_32F(viewport->xoffset);
-    OUT_CS_32F(viewport->yscale);
-    OUT_CS_32F(viewport->yoffset);
-    OUT_CS_32F(viewport->zscale);
-    OUT_CS_32F(viewport->zoffset);
-
-    /* XXX words still fail me. */
-    if (((struct r300_rs_state*)r300->rs_state.state)->enable_vte) {
-        OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
-    } else {
+    if (r300->tcl_bypass) {
+        BEGIN_CS(2);
         OUT_CS_REG(R300_VAP_VTE_CNTL, 0);
+        END_CS;
+    } else {
+        BEGIN_CS(9);
+        OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
+        OUT_CS_32F(viewport->xscale);
+        OUT_CS_32F(viewport->xoffset);
+        OUT_CS_32F(viewport->yscale);
+        OUT_CS_32F(viewport->yoffset);
+        OUT_CS_32F(viewport->zscale);
+        OUT_CS_32F(viewport->zoffset);
+        OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
+        END_CS;
     }
-    END_CS;
 }
 
 void r300_emit_texture_count(struct r300_context* r300)
index 4c0b307ea88c6d4eb3a04ec0f333bb5ebc3fa975..da1f40c8ef6125dc58ac8f101d821a9ac686f812 100644 (file)
@@ -605,8 +605,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
     /* Copy rasterizer state for Draw. */
     rs->rs = *state;
 
-    rs->enable_vte = !state->bypass_vs_clip_and_viewport;
-
 #ifdef PIPE_ARCH_LITTLE_ENDIAN
     rs->vap_control_status = R300_VC_NO_SWAP;
 #else
@@ -722,9 +720,12 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
         draw_set_rasterizer_state(r300->draw, &rs->rs);
     }
 
+    r300->tcl_bypass = rs->rs.bypass_vs_clip_and_viewport;
+
     r300->rs_state.state = rs;
     r300->rs_state.dirty = TRUE;
-    r300->viewport_state.dirty = TRUE; /* XXX */
+    /* XXX Why is this still needed, dammit!? */
+    r300->viewport_state.dirty = TRUE;
 
     /* XXX Clean these up when we move to atom emits */
     r300->dirty_state |= R300_NEW_RS_BLOCK;
index 4396978fd14a736bcb5e53c3aa549f729587fda2..192846411bac984458d69ca5b567fde8aa65aea6 100644 (file)
@@ -139,10 +139,10 @@ static void r300_vertex_psc(struct r300_context* r300)
 
     /* If TCL is bypassed, map vertex streams to equivalent VS output
      * locations. */
-    if (((struct r300_rs_state*)r300->rs_state.state)->enable_vte) {
-        stream_tab = identity;
-    } else {
+    if (r300->tcl_bypass) {
         stream_tab = r300->vs->stream_loc_notcl;
+    } else {
+        stream_tab = identity;
     }
 
     /* Vertex shaders have no semantics on their inputs,
@@ -556,9 +556,10 @@ static void r300_update_ztop(struct r300_context* r300)
 
 void r300_update_derived_state(struct r300_context* r300)
 {
+    /* XXX */
     if (r300->dirty_state &
         (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER |
-         R300_NEW_VERTEX_FORMAT)) {
+         R300_NEW_VERTEX_FORMAT) || r300->rs_state.dirty) {
         r300_update_derived_shader_state(r300);
     }