[Mesa-dev] [PATCH 4/6] draw: Flush when eltSize changes

Stéphane Marchesin marcheu at chromium.org
Tue Jan 24 00:55:49 PST 2012


From: Jakob Bornecrantz <wallbraker at gmail.com>

This could be improved so only the frontend is flushed since it
convertes all indecies to ushots and the fetch part of the middle
always perpares both linear and indexed.

Reviewed-by: Stéphane Marchesin <marcheu at chromium.org>
Tested-by: Stéphane Marchesin <marcheu at chromium.org>
---
 src/gallium/auxiliary/draw/draw_private.h |    1 +
 src/gallium/auxiliary/draw/draw_pt.c      |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index f53c16d..c3eca97 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -142,6 +142,7 @@ struct draw_context
       struct draw_pt_front_end *frontend;
       unsigned prim;
       unsigned opt;
+      unsigned eltSize; /* saved eltSize for flushing */
 
       struct {
          struct draw_pt_middle_end *fetch_emit;
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 3554ca1..d2e2126 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -52,7 +52,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE)
  *     - backend  -- the vbuf_render provided by the driver.
  */
 static boolean
-draw_pt_arrays(struct draw_context *draw, 
+draw_pt_arrays(struct draw_context *draw,
                unsigned prim,
                unsigned start, 
                unsigned count)
@@ -108,7 +108,10 @@ draw_pt_arrays(struct draw_context *draw,
 
    frontend = draw->pt.frontend;
 
-   if (frontend && (draw->pt.prim != prim || opt != draw->pt.opt)) {
+   if (frontend && (draw->pt.prim != prim ||
+                    draw->pt.opt != opt ||
+                    draw->pt.eltSize != draw->pt.user.eltSize)) {
+      /* XXX: flush only the frontend if eltSize changed */
       frontend->flush( frontend, DRAW_FLUSH_STATE_CHANGE );
       frontend = NULL;
    }
@@ -118,9 +121,10 @@ draw_pt_arrays(struct draw_context *draw,
 
       frontend->prepare( frontend, prim, middle, opt );
 
+      draw->pt.frontend = frontend;
+      draw->pt.eltSize = draw->pt.user.eltSize;
       draw->pt.prim = prim;
       draw->pt.opt = opt;
-      draw->pt.frontend = frontend;
    }
 
    frontend->run( frontend, start, count );
-- 
1.7.6.5



More information about the mesa-dev mailing list