draw: second argument to unmap is max, not count
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 17 Feb 2009 12:39:05 +0000 (12:39 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 17 Feb 2009 12:39:05 +0000 (12:39 +0000)
src/gallium/auxiliary/draw/draw_pipe_vbuf.c
src/gallium/auxiliary/draw/draw_pt_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c

index b08341145870843c8eb53ac529d958848a7f7024..ffeeeb6edebde295701376731f2a49638b6e53b4 100644 (file)
@@ -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) 
       {
index 8a6e01809e4c4efaf10c902b1010c82994d0aa71..064e16c295ca4df2e9c8dd7dbcc2fed36e849fe5 100644 (file)
@@ -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);
 
index c71228a71cc970b0840c6a4fbfe17302f519f479..6b7d02a19bc031843bf5734874abf1cffc7d8bb9 100644 (file)
@@ -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.
index 183ce1a833d883394b5da849c3c5e566d67bd4a8..cd9cd4b53fd7c9d9b1e644c1bf4a7835fb9d8ee8 100644 (file)
@@ -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 );