diff options
author | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 15:59:27 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-25 17:22:56 -0700 |
commit | 0bfd085e2866fbbd40209dcee23f0e6240583fe8 (patch) | |
tree | 5cefec02084d42517848529161b734d73557059a /src/mesa/pipe/draw/draw_validate.c | |
parent | bd8bf60b6f2402895e7159a4df644f8a4a307cf5 (diff) |
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.
Diffstat (limited to 'src/mesa/pipe/draw/draw_validate.c')
-rw-r--r-- | src/mesa/pipe/draw/draw_validate.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/mesa/pipe/draw/draw_validate.c index 3b1f5179a9..a626fb1fba 100644 --- a/src/mesa/pipe/draw/draw_validate.c +++ b/src/mesa/pipe/draw/draw_validate.c @@ -39,7 +39,7 @@ /** * Rebuild the rendering pipeline. */ -static void validate_begin( struct draw_stage *stage ) +static struct draw_stage *validate_pipeline( struct draw_stage *stage ) { struct draw_context *draw = stage->draw; struct draw_stage *next = draw->pipeline.rasterize; @@ -106,7 +106,45 @@ static void validate_begin( struct draw_stage *stage ) } draw->pipeline.first = next; - draw->pipeline.first->begin( draw->pipeline.first ); + //BP draw->pipeline.first->begin( draw->pipeline.first ); + return next; +} + + +static void validate_tri( struct draw_stage *stage, + struct prim_header *header ) +{ + struct draw_stage *pipeline = validate_pipeline( stage ); + pipeline->tri( pipeline, header ); +} + +static void validate_line( struct draw_stage *stage, + struct prim_header *header ) +{ + struct draw_stage *pipeline = validate_pipeline( stage ); + pipeline->line( pipeline, header ); +} + +static void validate_point( struct draw_stage *stage, + struct prim_header *header ) +{ + struct draw_stage *pipeline = validate_pipeline( stage ); + pipeline->point( pipeline, header ); +} + +static void validate_reset_stipple_counter( struct draw_stage *stage ) +{ + struct draw_stage *pipeline = validate_pipeline( stage ); + pipeline->reset_stipple_counter( pipeline ); +} + +static void validate_flush( struct draw_stage *stage, + unsigned flags ) +{ + /* May need to pass a backend flush on to the rasterize stage. + */ + if (stage->next) + stage->next->flush( stage->next, flags ); } @@ -124,13 +162,13 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw ) struct draw_stage *stage = CALLOC_STRUCT(draw_stage); stage->draw = draw; + stage->next = NULL; - stage->begin = validate_begin; - stage->point = NULL; - stage->line = NULL; - stage->tri = NULL; - stage->end = NULL; - stage->reset_stipple_counter = NULL; + stage->point = validate_point; + stage->line = validate_line; + stage->tri = validate_tri; + stage->flush = validate_flush; + stage->reset_stipple_counter = validate_reset_stipple_counter; stage->destroy = validate_destroy; return stage; |