Mesa (master): svga: flush when transitioning between HW and SW rendering paths

Brian Paul brianp at kemper.freedesktop.org
Thu Feb 17 00:16:20 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Feb 16 14:20:14 2011 -0700

svga: flush when transitioning between HW and SW rendering paths

To avoid mixing HW and SW rendering with the same vertex buffer.

---

 src/gallium/drivers/svga/svga_context.h   |    3 +++
 src/gallium/drivers/svga/svga_pipe_draw.c |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 6fd0bdb..4d4f503 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -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:
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index 001ec36..d98b9b0 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -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.




More information about the mesa-commit mailing list