From: José Fonseca Date: Wed, 7 Nov 2007 13:07:20 +0000 (+0000) Subject: Reset temporary vertices ids. X-Git-Tag: 062012170305~17580^2~390^2~3384 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e22180fc893bb09bf6b990bc4e858fd85f522ab;p=profile%2Fivi%2Fmesa.git Reset temporary vertices ids. --- diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index 80317dd..0de8bed 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -243,6 +243,18 @@ void draw_alloc_tmps( struct draw_stage *stage, unsigned nr ) } } +/** + * Reset the verticies ids of this and subsequent stages. + */ +void draw_reset_tmps( struct draw_stage *stage ) +{ + unsigned i; + + if (stage->tmp) + for (i = 0; i < stage->nr_tmps; i++) + stage->tmp[i]->vertex_id = UNDEFINED_VERTEX_ID; +} + void draw_free_tmps( struct draw_stage *stage ) { if (stage->tmp) { @@ -251,9 +263,24 @@ void draw_free_tmps( struct draw_stage *stage ) } } + boolean draw_use_sse(struct draw_context *draw) { return (boolean) draw->use_sse; } +void draw_reset_vertex_ids(struct draw_context *draw) +{ + struct draw_stage *stage = draw->pipeline.first; + + while (stage) { + if (stage->reset_tmps) + stage->reset_tmps(stage); + else + draw_reset_tmps(stage); + stage = stage->next; + } + + draw_vertex_cache_reset_vertex_ids(draw); +} diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index bdc3a6b..dc4057b 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -116,6 +116,13 @@ struct draw_stage void (*end)( struct draw_stage * ); + /** + * Reset temporary vertices ids in this stage + * + * draw_free_tmps will be called instead if null. + */ + void (*reset_tmps)( struct draw_stage * ); + void (*reset_stipple_counter)( struct draw_stage * ); }; @@ -254,8 +261,11 @@ extern struct draw_stage *draw_validate_stage( struct draw_context *context ); extern void draw_free_tmps( struct draw_stage *stage ); +extern void draw_reset_tmps( struct draw_stage *stage ); extern void draw_alloc_tmps( struct draw_stage *stage, unsigned nr ); +extern void draw_reset_vertex_ids( struct draw_context *draw ); + extern int draw_vertex_cache_check_space( struct draw_context *draw, unsigned nr_verts ); diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/mesa/pipe/i915simple/i915_prim_vbuf.c index 8881d16..a78c2b0 100644 --- a/src/mesa/pipe/i915simple/i915_prim_vbuf.c +++ b/src/mesa/pipe/i915simple/i915_prim_vbuf.c @@ -290,9 +290,11 @@ static void vbuf_flush_elements( struct draw_stage *stage ) break; case PIPE_PRIM_LINES: hwprim = PRIM3D_LINELIST; + assert(nr % 2 == 0); break; case PIPE_PRIM_TRIANGLES: hwprim = PRIM3D_TRILIST; + assert(nr % 3 == 0); break; default: assert(0); @@ -365,7 +367,7 @@ static void vbuf_flush_vertices( struct draw_stage *stage ) * issues uploading vertices if the hardware wants to flush when * we flush. */ - draw_vertex_cache_reset_vertex_ids( vbuf->i915->draw ); + draw_reset_vertex_ids( vbuf->i915->draw ); } /* FIXME: handle failure */ diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c index 7cb3da6..59cf1c4 100644 --- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c +++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c @@ -243,7 +243,7 @@ static void vbuf_flush_elements( struct draw_stage *stage ) * issues uploading vertices if the hardware wants to flush when * we flush. */ - draw_vertex_cache_reset_vertex_ids( vbuf->draw_context ); + draw_reset_vertex_ids( vbuf->draw_context ); } stage->tri = vbuf_first_tri;