gallium: only call vertex/prim queue flush when there is something to flush
authorKeith Whitwell <keith@tungstengraphics.com>
Mon, 28 Jan 2008 11:12:11 +0000 (11:12 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Mon, 28 Jan 2008 11:12:11 +0000 (11:12 +0000)
src/mesa/pipe/draw/draw_prim.c
src/mesa/pipe/draw/draw_vertex_fetch.c
src/mesa/pipe/draw/draw_vertex_shader.c

index 243381aec0c4f5b5bc29b4c2b4cf77539f7b0c57..2a612a1673305811f07c5041980933e11c3ba5e4 100644 (file)
@@ -63,8 +63,7 @@ static void draw_prim_queue_flush( struct draw_context *draw )
       fprintf(stdout,"Flushing with %d prims, %d verts\n",
              draw->pq.queue_nr, draw->vs.queue_nr);
 
-   if (draw->pq.queue_nr == 0)
-      return;
+   assert (draw->pq.queue_nr != 0);
 
    /* NOTE: we cannot save draw->pipeline->first in a local var because
     * draw->pipeline->first is often changed by the first call to tri(),
@@ -109,10 +108,12 @@ void draw_do_flush( struct draw_context *draw, unsigned flags )
 
 
    if (flags >= DRAW_FLUSH_SHADER_QUEUE) {
-      draw_vertex_shader_queue_flush(draw);
+      if (draw->vs.queue_nr)
+        draw_vertex_shader_queue_flush(draw);
 
       if (flags >= DRAW_FLUSH_PRIM_QUEUE) {
-         draw_prim_queue_flush(draw);
+        if (draw->pq.queue_nr)
+           draw_prim_queue_flush(draw);
 
         if (flags >= DRAW_FLUSH_VERTEX_CACHE) {
             draw_vertex_cache_invalidate(draw);
index af3983b7f0310b5c757262466b89c917f4a65733..143acdd3b49a65f1e9dd164f2bfa7230eca0b15b 100644 (file)
@@ -158,6 +158,14 @@ FETCH_ATTRIB( A8R8G8B8_UNORM,       4, CVT_8_UNORM )
 
 static fetch_func get_fetch_func( enum pipe_format format )
 {
+#if 0
+   {
+      char tmp[80];
+      pf_sprint_name(tmp, format);
+      _mesa_printf("%s: %s\n", __FUNCTION__, tmp);
+   }
+#endif
+
    switch (format) {
    case PIPE_FORMAT_R64_FLOAT:
       return fetch_R64_FLOAT;
@@ -317,6 +325,8 @@ void draw_update_vertex_fetch( struct draw_context *draw )
 {
    unsigned nr_attrs, i;
 
+//   _mesa_printf("%s\n", __FUNCTION__);
+   
    /* this may happend during context init */
    if (!draw->vertex_shader)
       return;
index 3041974b9a49b296ef5a2045a8c1ee4dcf775ac7..289c35c7ae402abd54303a7ad31783431a7b12a4 100644 (file)
@@ -201,6 +201,8 @@ draw_vertex_shader_queue_flush(struct draw_context *draw)
 {
    unsigned i, j;
 
+   assert(draw->vs.queue_nr != 0);
+
    /* XXX: do this on statechange: 
     */
    draw_update_vertex_fetch( draw );