From 0bfd085e2866fbbd40209dcee23f0e6240583fe8 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 25 Jan 2008 15:59:27 -0700 Subject: gallium: replace prim pipeline begin/end() functions with flush() This is basically half of Keith's draw/flush patch. The stage->point/line/tri() functions are now self-validating, the validator functions are installed by the flush() function. There were excessive calls to validate_pipeline(), however. This was caused by draw_prim_queue_flush() keeping a local 'first' variable that always pointed to the validate functions. Replaced 'first' with 'draw->pipeline.first'. Performance in gears is up just slightly with this patch. --- src/mesa/pipe/draw/draw_unfilled.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/mesa/pipe/draw/draw_unfilled.c') diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c index 786826b33c..364bda8b79 100644 --- a/src/mesa/pipe/draw/draw_unfilled.c +++ b/src/mesa/pipe/draw/draw_unfilled.c @@ -55,15 +55,6 @@ static INLINE struct unfilled_stage *unfilled_stage( struct draw_stage *stage ) } -static void unfilled_begin( struct draw_stage *stage ) -{ - struct unfilled_stage *unfilled = unfilled_stage(stage); - - unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */ - unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */ - - stage->next->begin( stage->next ); -} static void point( struct draw_stage *stage, struct vertex_header *v0 ) @@ -142,6 +133,20 @@ static void unfilled_tri( struct draw_stage *stage, } } + +static void unfilled_first_tri( struct draw_stage *stage, + struct prim_header *header ) +{ + struct unfilled_stage *unfilled = unfilled_stage(stage); + + unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */ + unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */ + + stage->tri = unfilled_tri; + stage->tri( stage, header ); +} + + static void unfilled_line( struct draw_stage *stage, struct prim_header *header ) { @@ -156,9 +161,10 @@ static void unfilled_point( struct draw_stage *stage, } -static void unfilled_end( struct draw_stage *stage ) +static void unfilled_flush( struct draw_stage *stage, + unsigned flags ) { - stage->next->end( stage->next ); + stage->next->flush( stage->next, flags ); } @@ -187,11 +193,10 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw ) unfilled->stage.draw = draw; unfilled->stage.next = NULL; unfilled->stage.tmp = NULL; - unfilled->stage.begin = unfilled_begin; unfilled->stage.point = unfilled_point; unfilled->stage.line = unfilled_line; - unfilled->stage.tri = unfilled_tri; - unfilled->stage.end = unfilled_end; + unfilled->stage.tri = unfilled_first_tri; + unfilled->stage.flush = unfilled_flush; unfilled->stage.reset_stipple_counter = unfilled_reset_stipple_counter; unfilled->stage.destroy = unfilled_destroy; -- cgit v1.2.3