Module: Mesa
Branch: master
Commit: 3d73852121f13832f6bc87918798ff96589d0349
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d73852121f13832f6bc87918798ff96589d0349

Author: Maciej Cencora <mac...@osiris.(none)>
Date:   Sun Nov  1 18:50:52 2009 +0100

r300g: fix geometry corruptions

PVS flush is needed before changing the vertex shader or vertex shader 
constants.

---

 src/gallium/drivers/r300/r300_emit.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index de27f09..5b03c1a 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -652,7 +652,7 @@ void r300_emit_vertex_program_code(struct r300_context* 
r300,
         return;
     }
 
-    BEGIN_CS(11 + code->length);
+    BEGIN_CS(9 + code->length);
     /* R300_VAP_PVS_CODE_CNTL_0
      * R300_VAP_PVS_CONST_CNTL
      * R300_VAP_PVS_CODE_CNTL_1
@@ -674,7 +674,6 @@ void r300_emit_vertex_program_code(struct r300_context* 
r300,
             R300_PVS_NUM_CNTLRS(5) |
             R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) |
             R300_PVS_VF_MAX_VTX_NUM(12));
-    OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
     END_CS;
 }
 
@@ -749,6 +748,15 @@ void r300_flush_textures(struct r300_context* r300)
     END_CS;
 }
 
+static void r300_flush_pvs(struct r300_context* r300)
+{
+    CS_LOCALS(r300);
+
+    BEGIN_CS(2);
+    OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+    END_CS;
+}
+
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300)
 {
@@ -922,6 +930,10 @@ validate:
         r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT;
     }
 
+    if (r300->dirty_state & (R300_NEW_VERTEX_SHADER | 
R300_NEW_VERTEX_SHADER_CONSTANTS)) {
+        r300_flush_pvs(r300);
+    }
+
     if (r300->dirty_state & R300_NEW_VERTEX_SHADER) {
         r300_emit_vertex_shader(r300, r300->vs);
         r300->dirty_state &= ~R300_NEW_VERTEX_SHADER;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to