svga: flush when transitioning between HW and SW rendering paths
authorBrian Paul <brianp@vmware.com>
Wed, 16 Feb 2011 21:20:14 +0000 (14:20 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 17 Feb 2011 00:07:02 +0000 (17:07 -0700)
To avoid mixing HW and SW rendering with the same vertex buffer.

src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_draw.c

index 6fd0bdb38b80c791309119aa344fb77d4122466d..4d4f50366eaa05bacc1eb6c3f327bb0171a56c57 100644 (file)
@@ -367,6 +367,9 @@ struct svga_context
 
    /** List of buffers with queued transfers */
    struct list_head dirty_buffers;
+
+   /** Was the previous draw done with the SW path? */
+   boolean prev_draw_swtnl;
 };
 
 /* A flag for each state_tracker state object:
index 001ec3616c4017d1e92fb74ffff6cbd94d323c10..d98b9b0e0005bd8b0b53c419dd557a2de4823dc9 100644 (file)
@@ -157,6 +157,14 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    if (!u_trim_pipe_prim( info->mode, &count ))
       return;
 
+   if (svga->state.sw.need_swtnl != svga->prev_draw_swtnl) {
+      /* We're switching between SW and HW drawing.  Do a flush to avoid
+       * mixing HW and SW rendering with the same vertex buffer.
+       */
+      pipe->flush(pipe, ~0, NULL);
+      svga->prev_draw_swtnl = svga->state.sw.need_swtnl;
+   }
+
    /*
     * Mark currently bound target surfaces as dirty
     * doesn't really matter if it is done before drawing.