Mesa (master): llvmpipe: Ensure outdated framebuffer state is not reused in lp_setup_bind_framebuffer ().

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Jun 28 08:54:47 PDT 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Jun 28 16:28:55 2010 +0100

llvmpipe: Ensure outdated framebuffer state is not reused in lp_setup_bind_framebuffer().

We were starting a scene whenever lp_setup_get_vertex_info() was called by
the draw module. So when when all primitives were culled/clipped, not only
did we create a new scene for nothing, but we end up using the old scene
with the old framebuffer state instead of a new one.

Fix consists in:
- don't call lp_setup_update_state() in lp_setup_get_vertex_info() -- no
  longer necessary
- always setting the scene state before binning a command -- query
  commands were bypassing it
- assert no old scene is reused in lp_setup_bind_framebuffer()

---

 src/gallium/drivers/llvmpipe/lp_setup.c      |    9 +++++++++
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c |    4 ----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index e8aafee..9e319fd 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -297,6 +297,11 @@ lp_setup_bind_framebuffer( struct lp_setup_context *setup,
     */
    set_scene_state( setup, SETUP_FLUSHED );
 
+   /*
+    * Ensure the old scene is not reused.
+    */
+   assert(!setup->scene);
+
    /* Set new state.  This will be picked up later when we next need a
     * scene.
     */
@@ -933,6 +938,8 @@ lp_setup_begin_query(struct lp_setup_context *setup,
 
    memset(pq->count, 0, sizeof(pq->count));  /* reset all counters */
 
+   set_scene_state( setup, SETUP_ACTIVE );
+
    cmd_arg.query_obj = pq;
    lp_scene_bin_everywhere(scene, lp_rast_begin_query, cmd_arg);
    pq->binned = TRUE;
@@ -948,6 +955,8 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
    struct lp_scene * scene = lp_setup_get_current_scene(setup);
    union lp_rast_cmd_arg cmd_arg;
 
+   set_scene_state( setup, SETUP_ACTIVE );
+
    cmd_arg.query_obj = pq;
    lp_scene_bin_everywhere(scene, lp_rast_end_query, cmd_arg);
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
index f6a424f..e53a62c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
@@ -60,10 +60,6 @@ static const struct vertex_info *
 lp_setup_get_vertex_info(struct vbuf_render *vbr)
 {
    struct lp_setup_context *setup = lp_setup_context(vbr);
-
-   /* vertex size/info depends on the latest state */
-   lp_setup_update_state(setup);
-
    return setup->vertex_info;
 }
 



More information about the mesa-commit mailing list