From: Keith Whitwell Date: Tue, 17 Feb 2009 12:39:05 +0000 (+0000) Subject: draw: second argument to unmap is max, not count X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c4f67b980b6bec5788336a9cdd18c4fcec5e492;p=mesa.git draw: second argument to unmap is max, not count --- diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c index b0834114587..ffeeeb6edeb 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 8a6e01809e4..064e16c295c 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 c71228a71cc..6b7d02a19bc 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 183ce1a833d..cd9cd4b53fd 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 );