Mesa (master): draw: second argument to unmap is max, not count

Keith Whitwell keithw at kemper.freedesktop.org
Wed Feb 18 12:55:58 UTC 2009


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

Author: Keith Whitwell <keith at tungstengraphics.com>
Date:   Tue Feb 17 12:39:05 2009 +0000

draw: second argument to unmap is max, not count

---

 src/gallium/auxiliary/draw/draw_pipe_vbuf.c        |    2 +-
 src/gallium/auxiliary/draw/draw_pt_emit.c          |    7 +++++--
 src/gallium/auxiliary/draw/draw_pt_fetch_emit.c    |    6 +++---
 .../auxiliary/draw/draw_pt_fetch_shade_emit.c      |    6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index b083411..ffeeeb6 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -341,7 +341,7 @@ vbuf_flush_vertices( struct vbuf_stage *vbuf )
 {
    if(vbuf->vertices) {
 
-      vbuf->render->unmap_vertices( vbuf->render, 0, vbuf->nr_vertices );
+      vbuf->render->unmap_vertices( vbuf->render, 0, vbuf->nr_vertices - 1 );
 
       if (vbuf->nr_indices) 
       {
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index 8a6e018..064e16c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -165,6 +165,9 @@ void draw_pt_emit( struct pt_emit *emit,
     */
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
 
+   if (vertex_count == 0)
+      return;
+
    if (vertex_count >= UNDEFINED_VERTEX_ID) {
       assert(0);
       return;
@@ -205,7 +208,7 @@ void draw_pt_emit( struct pt_emit *emit,
 
    render->unmap_vertices( render, 
                            0, 
-                           vertex_count );
+                           vertex_count - 1 );
 
    render->draw(render,
 		elts,
@@ -272,7 +275,7 @@ void draw_pt_emit_linear(struct pt_emit *emit,
       }
    }
 
-   render->unmap_vertices( render, 0, count );
+   render->unmap_vertices( render, 0, count - 1 );
 
    render->draw_arrays(render, 0, count);
 
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index c71228a..6b7d02a 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -263,7 +263,7 @@ static void fetch_emit_run( struct draw_pt_middle_end *middle,
 
    draw->render->unmap_vertices( draw->render, 
                                  0, 
-                                 (ushort)fetch_count );
+                                 (ushort)(fetch_count - 1) );
 
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
@@ -319,7 +319,7 @@ static void fetch_emit_run_linear( struct draw_pt_middle_end *middle,
       }
    }
 
-   draw->render->unmap_vertices( draw->render, 0, count );
+   draw->render->unmap_vertices( draw->render, 0, count - 1 );
 
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
@@ -370,7 +370,7 @@ static boolean fetch_emit_run_linear_elts( struct draw_pt_middle_end *middle,
                          count,
                          hw_verts );
 
-   draw->render->unmap_vertices( draw->render, 0, (ushort)count );
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
 
    /* XXX: Draw arrays path to avoid re-emitting index list again and
     * again.
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 183ce1a..cd9cd4b 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -267,7 +267,7 @@ static void fse_run_linear( struct draw_pt_middle_end *middle,
       }
    }
    
-   draw->render->unmap_vertices( draw->render, 0, (ushort)count );
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
 
    /* Draw arrays path to avoid re-emitting index list again and
     * again.
@@ -333,7 +333,7 @@ fse_run(struct draw_pt_middle_end *middle,
       }
    }
 
-   draw->render->unmap_vertices( draw->render, 0, (ushort)fetch_count );
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(fetch_count - 1) );
    
    draw->render->draw( draw->render, 
                        draw_elts, 
@@ -390,7 +390,7 @@ static boolean fse_run_linear_elts( struct draw_pt_middle_end *middle,
                        draw_count );
    
 
-   draw->render->unmap_vertices( draw->render, 0, (ushort) count );
+   draw->render->unmap_vertices( draw->render, 0, (ushort)(count - 1) );
 
    draw->render->release_vertices( draw->render );
 




More information about the mesa-commit mailing list