Mesa (master): llvmpipe: Add a new scene state to describe scenes which only have state changes.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Jun 30 03:22:34 PDT 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Jun 30 11:10:33 2010 +0100

llvmpipe: Add a new scene state to describe scenes which only have state changes.

It's a rare condition, but it may happen if all primitives are
clipped/culled.

For now we just do a no-op rasterization, but we could bypass it.

---

 src/gallium/drivers/llvmpipe/lp_setup.c         |   38 +++++++++++++---------
 src/gallium/drivers/llvmpipe/lp_setup_context.h |    7 ++--
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 9e319fd..158f9e8 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -63,15 +63,7 @@ struct lp_scene *
 lp_setup_get_current_scene(struct lp_setup_context *setup)
 {
    if (!setup->scene) {
-
-      /* wait for a free/empty scene
-       */
-      setup->scene = lp_scene_dequeue(setup->empty_scenes, TRUE);
-
-      assert(lp_scene_is_empty(setup->scene));
-
-      lp_scene_begin_binning(setup->scene,
-                             &setup->fb );
+      set_scene_state( setup, SETUP_EMPTY );
    }
    return setup->scene;
 }
@@ -233,22 +225,36 @@ set_scene_state( struct lp_setup_context *setup,
    LP_DBG(DEBUG_SETUP, "%s old %d new %d\n", __FUNCTION__, old_state, new_state);
 
    switch (new_state) {
-   case SETUP_ACTIVE:
-      begin_binning( setup );
+   case SETUP_EMPTY:
+      assert(old_state == SETUP_FLUSHED);
+      assert(setup->scene == NULL);
+
+      /* wait for a free/empty scene
+       */
+      setup->scene = lp_scene_dequeue(setup->empty_scenes, TRUE);
+      assert(lp_scene_is_empty(setup->scene));
+      lp_scene_begin_binning(setup->scene,
+                             &setup->fb );
       break;
 
    case SETUP_CLEARED:
-      if (old_state == SETUP_ACTIVE) {
-         assert(0);
-         return;
-      }
+      assert(old_state == SETUP_EMPTY);
+      assert(setup->scene != NULL);
+      break;
+
+   case SETUP_ACTIVE:
+      assert(old_state == SETUP_EMPTY ||
+             old_state == SETUP_CLEARED);
+      assert(setup->scene != NULL);
+      begin_binning( setup );
       break;
-      
+
    case SETUP_FLUSHED:
       if (old_state == SETUP_CLEARED)
          execute_clears( setup );
       else
          lp_setup_rasterize_scene( setup );
+      assert(setup->scene == NULL);
       break;
 
    default:
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index c8b8a24..8f4e00f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -101,9 +101,10 @@ struct lp_setup_context
    } clear;
 
    enum setup_state {
-      SETUP_FLUSHED,
-      SETUP_CLEARED,
-      SETUP_ACTIVE
+      SETUP_FLUSHED,    /**< scene is null */
+      SETUP_EMPTY,      /**< scene exists but has only state changes */
+      SETUP_CLEARED,    /**< scene exists but has only clears */
+      SETUP_ACTIVE      /**< scene exists and has at least one draw/query */
    } state;
    
    struct {



More information about the mesa-commit mailing list