r300-gallium: Cleanup some state emit, move vertex format state to r300_emit.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 23 Feb 2009 12:48:42 +0000 (04:48 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 23 Feb 2009 13:59:58 +0000 (05:59 -0800)
No need to explicitly update derived state, as it will be done automatically.

src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_swtcl_emit.c

index 37dc9e86d649a7ddccad0eb5b877b155007de034..15a87515494343aaea8b07cd78d1de0e1587d7c1 100644 (file)
@@ -35,7 +35,6 @@ static boolean r300_draw_range_elements(struct pipe_context* pipe,
     int i;
 
     if (r300->dirty_state) {
-        r300_update_derived_state(r300);
         r300_emit_dirty_state(r300);
     }
 
index d57ccffcb05a6ccb75e7c5597f8e135e5ab33805..960f45f651f9299add02be9d68593b6efb4791d8 100644 (file)
@@ -219,6 +219,32 @@ void r300_emit_scissor_state(struct r300_context* r300,
     END_CS;
 }
 
+void r300_emit_vertex_format_state(struct r300_context* r300)
+{
+    CS_LOCALS(r300);
+    int i;
+
+    BEGIN_CS(6);
+    OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[0]);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[1]);
+    OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[2]);
+    OUT_CS(r300->vertex_info.vinfo.hwfmt[3]);
+    END_CS;
+
+    BEGIN_CS(18);
+    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
+    for (i = 0; i < 8; i++) {
+        OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]);
+    }
+    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
+    for (i = 0; i < 8; i++) {
+        OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]);
+    }
+    END_CS;
+}
+
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300)
 {
@@ -269,4 +295,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
         r300_emit_scissor_state(r300, r300->scissor_state);
         r300->dirty_state &= ~R300_NEW_SCISSOR;
     }
+
+    if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) {
+        r300_emit_vertex_format_state(r300);
+        r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT;
+    }
 }
index 1ae69e7d13049e5f0ce6be37171a3c2e7e51d280..141fa57590ea2a63ad768aa18af0f68cb6b7d1ae 100644 (file)
@@ -182,30 +182,8 @@ static void prepare_render(struct r300_swtcl_render* render)
     CS_LOCALS(r300);
 
     /* Make sure that all possible state is emitted. */
-    r300_update_derived_state(r300);
     r300_emit_dirty_state(r300);
 
-    /* Take care of vertex formats and routes. */
-    BEGIN_CS(6);
-    OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
-    OUT_CS(r300->vertex_info.vinfo.hwfmt[0]);
-    OUT_CS(r300->vertex_info.vinfo.hwfmt[1]);
-    OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
-    OUT_CS(r300->vertex_info.vinfo.hwfmt[2]);
-    OUT_CS(r300->vertex_info.vinfo.hwfmt[3]);
-    END_CS;
-
-    BEGIN_CS(18);
-    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
-    for (i = 0; i < 8; i++) {
-        OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]);
-    }
-    OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
-    for (i = 0; i < 8; i++) {
-        OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]);
-    }
-    END_CS;
-
     /* Set the pointer to our vertex buffer. The emitted values are this:
      * PACKET3 [3D_LOAD_VBPNTR]
      * COUNT   [1]