llvmpipe: check for dirty context state in lp_setup_update_state()
authorBrian Paul <brianp@vmware.com>
Fri, 16 Apr 2010 15:49:33 +0000 (09:49 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 16 Apr 2010 15:49:33 +0000 (09:49 -0600)
This fixes problems with the draw module's aaline, aapoint and
pstipple stages where we change some driver state after the call
to the draw module's draw_arrays() function.

src/gallium/drivers/llvmpipe/lp_setup.c

index 97a6b5422bd6852c373bf3e3a92d1852f49d64e1..ffbc7fc4ea08dd39208a632255b9e6845a036fe5 100644 (file)
@@ -37,6 +37,7 @@
 #include "util/u_memory.h"
 #include "util/u_pack_color.h"
 #include "util/u_surface.h"
+#include "lp_context.h"
 #include "lp_scene.h"
 #include "lp_scene_queue.h"
 #include "lp_texture.h"
@@ -45,6 +46,7 @@
 #include "lp_rast.h"
 #include "lp_setup_context.h"
 #include "lp_screen.h"
+#include "lp_state.h"
 #include "state_tracker/sw_winsys.h"
 
 #include "draw/draw_context.h"
@@ -598,6 +600,20 @@ lp_setup_update_state( struct lp_setup_context *setup )
 
    assert(setup->fs.current.jit_function);
 
+   /* Some of the 'draw' pipeline stages may have changed some driver state.
+    * Make sure we've processed those state changes before anything else.
+    *
+    * XXX this is the only place where llvmpipe_context is used in the
+    * setup code.  This may get refactored/changed...
+    */
+   {
+      struct llvmpipe_context *lp = llvmpipe_context(scene->pipe);
+      if (lp->dirty) {
+         llvmpipe_update_derived(lp);
+      }
+      assert(lp->dirty == 0);
+   }
+
    if(setup->dirty & LP_SETUP_NEW_BLEND_COLOR) {
       uint8_t *stored;
       unsigned i, j;