Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into r600_state_predict
[mesa.git] / src / mesa / drivers / dri / r600 / r700_render.c
index 899c2cf05c3f78f6a0bc5b04e6b04aa6082e0d8c..d64e921bdad8bee72ffea85700e0d2efe9d59b7a 100644 (file)
@@ -53,6 +53,8 @@
 #include "r700_fragprog.h"
 #include "r700_state.h"
 
+#include "radeon_common_context.h"
+
 void r700WaitForIdle(context_t *context);
 void r700WaitForIdleClean(context_t *context);
 GLboolean r700SendTextureState(context_t *context);
@@ -345,6 +347,13 @@ static GLboolean r700RunRender(GLcontext * ctx,
         fprintf(stderr, "%s: cs begin at %d\n",
                 __func__, context->radeon.cmdbuf.cs->cdw);
 
+    /* always emit CB base to prevent
+     * lock ups on some chips.
+     */
+    R600_STATECHANGE(context, cb_target);
+    /* mark vtx as dirty since it changes per-draw */
+    R600_STATECHANGE(context, vtx);
+
     r700UpdateShaders(ctx);
     r700SetScissor(context);
     r700SetupVertexProgram(ctx);
@@ -384,7 +393,9 @@ static GLboolean r700RunRender(GLcontext * ctx,
         fprintf(stderr, "%s: cs end at %d\n",
                 __func__, context->radeon.cmdbuf.cs->cdw);
 
-    assert(context->radeon.cmdbuf.cs->cdw <= emit_end);
+    if ( emit_end < context->radeon.cmdbuf.cs->cdw )
+       WARN_ONCE("Rendering was %d commands larger than predicted size."
+              " We might overflow  command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end);
 
     return GL_FALSE;
 }