diff options
author | Michal <[email protected]> | 2007-11-23 11:30:51 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2007-12-09 14:03:34 +0000 |
commit | d75454840672f462de933724daae24a839aac48e (patch) | |
tree | 71242b6abbea53ca4753bd8900d582a1e6ebfa36 /src/mesa/pipe | |
parent | 74fe189b2e1d8f661a1678e65d21da788b3b4435 (diff) |
gallium: add draw_stage::destroy().
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/draw/draw_clip.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_context.c | 10 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_cull.c | 9 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_feedback.c | 7 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_flatshade.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_linestipple.c | 9 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_offset.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_private.h | 2 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_twoside.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_unfilled.c | 8 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_validate.c | 5 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vbuf.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_wide_prims.c | 10 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_prim_emit.c | 6 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_setup.c | 7 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_prim_vbuf.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/tgsi/exec/tgsi_exec.c | 8 |
17 files changed, 128 insertions, 7 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index e4c257a0ee2..c50376f11fe 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -415,6 +415,13 @@ static void clip_reset_stipple_counter( struct draw_stage *stage ) } +static void clip_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Allocate a new clipper stage. * \return pointer to new stage object @@ -432,6 +439,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw ) clipper->stage.tri = clip_tri; clipper->stage.end = clip_end; clipper->stage.reset_stipple_counter = clip_reset_stipple_counter; + clipper->stage.destroy = clip_destroy; clipper->plane = draw->plane; diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index e7997180b5b..c7ad4c3d68c 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -92,6 +92,16 @@ struct draw_context *draw_create( void ) void draw_destroy( struct draw_context *draw ) { + draw->pipeline.wide->destroy( draw->pipeline.wide ); + draw->pipeline.unfilled->destroy( draw->pipeline.unfilled ); + draw->pipeline.twoside->destroy( draw->pipeline.twoside ); + draw->pipeline.offset->destroy( draw->pipeline.offset ); + draw->pipeline.clip->destroy( draw->pipeline.clip ); + draw->pipeline.flatshade->destroy( draw->pipeline.flatshade ); + draw->pipeline.cull->destroy( draw->pipeline.cull ); + draw->pipeline.feedback->destroy( draw->pipeline.feedback ); + draw->pipeline.validate->destroy( draw->pipeline.validate ); + draw->pipeline.rasterize->destroy( draw->pipeline.rasterize ); FREE( draw->vcache.vertex[0] ); /* Frees all the vertices. */ FREE( draw ); } diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c index f898834ba5d..9bd53f45f26 100644 --- a/src/mesa/pipe/draw/draw_cull.c +++ b/src/mesa/pipe/draw/draw_cull.c @@ -116,6 +116,14 @@ static void cull_reset_stipple_counter( struct draw_stage *stage ) stage->next->reset_stipple_counter( stage->next ); } + +static void cull_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Create a new polygon culling stage. */ @@ -133,6 +141,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw ) cull->stage.tri = cull_tri; cull->stage.end = cull_end; cull->stage.reset_stipple_counter = cull_reset_stipple_counter; + cull->stage.destroy = cull_destroy; return &cull->stage; } diff --git a/src/mesa/pipe/draw/draw_feedback.c b/src/mesa/pipe/draw/draw_feedback.c index b9906e5b4b0..aea6a8184c0 100644 --- a/src/mesa/pipe/draw/draw_feedback.c +++ b/src/mesa/pipe/draw/draw_feedback.c @@ -224,6 +224,12 @@ static void feedback_reset_stipple_counter( struct draw_stage *stage ) } +static void feedback_destroy( struct draw_stage *stage ) +{ + FREE( stage ); +} + + /** * Create feedback drawing stage. */ @@ -239,6 +245,7 @@ struct draw_stage *draw_feedback_stage( struct draw_context *draw ) feedback->stage.tri = feedback_tri; feedback->stage.end = feedback_end; feedback->stage.reset_stipple_counter = feedback_reset_stipple_counter; + feedback->stage.destroy = feedback_destroy; return &feedback->stage; } diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index d46e53f2be2..d7551e79481 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -127,6 +127,13 @@ static void flatshade_reset_stipple_counter( struct draw_stage *stage ) } +static void flatshade_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Create flatshading drawing stage. */ @@ -144,6 +151,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw ) flatshade->tri = flatshade_tri; flatshade->end = flatshade_end; flatshade->reset_stipple_counter = flatshade_reset_stipple_counter; + flatshade->destroy = flatshade_destroy; return flatshade; } diff --git a/src/mesa/pipe/draw/draw_linestipple.c b/src/mesa/pipe/draw/draw_linestipple.c index 1fac1ebe66e..5f0db99b23f 100644 --- a/src/mesa/pipe/draw/draw_linestipple.c +++ b/src/mesa/pipe/draw/draw_linestipple.c @@ -241,12 +241,18 @@ static void stipple_begin( struct clip_pipe_stage *stage ) } - static void stipple_end( struct clip_pipe_stage *stage ) { stage->next->end( stage->next ); } + +static void stipple_destroy( struct clip_pipe_stage *stage ) +{ + FREE( stage ); +} + + struct clip_pipe_stage *clip_pipe_stipple( struct clip_pipeline *pipe ) { struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage); @@ -261,6 +267,7 @@ struct clip_pipe_stage *clip_pipe_stipple( struct clip_pipeline *pipe ) stipple->stage.tri = clip_passthrough_tri; stipple->stage.reset_tmps = clip_pipe_reset_tmps; stipple->stage.end = stipple_end; + stipple->stage.destroy = stipple_destroy; return &stipple->stage; } diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c index 6acc7cbcd29..f8a01db3dd8 100644 --- a/src/mesa/pipe/draw/draw_offset.c +++ b/src/mesa/pipe/draw/draw_offset.c @@ -151,6 +151,13 @@ static void offset_reset_stipple_counter( struct draw_stage *stage ) } +static void offset_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Create polygon offset drawing stage. */ @@ -168,6 +175,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw ) offset->stage.tri = offset_tri; offset->stage.end = offset_end; offset->stage.reset_stipple_counter = offset_reset_stipple_counter; + offset->stage.destroy = offset_destroy; return &offset->stage; } diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 53d74511131..ca5ca7b3c90 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -124,6 +124,8 @@ struct draw_stage void (*reset_tmps)( struct draw_stage * ); void (*reset_stipple_counter)( struct draw_stage * ); + + void (*destroy)( struct draw_stage * ); }; diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index d987b005986..00b4ee45cdc 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -146,6 +146,13 @@ static void twoside_reset_stipple_counter( struct draw_stage *stage ) } +static void twoside_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Create twoside pipeline stage. */ @@ -163,6 +170,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw ) twoside->stage.tri = twoside_tri; twoside->stage.end = twoside_end; twoside->stage.reset_stipple_counter = twoside_reset_stipple_counter; + twoside->stage.destroy = twoside_destroy; return &twoside->stage; } diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c index 6cab086a452..786826b33c1 100644 --- a/src/mesa/pipe/draw/draw_unfilled.c +++ b/src/mesa/pipe/draw/draw_unfilled.c @@ -168,6 +168,13 @@ static void unfilled_reset_stipple_counter( struct draw_stage *stage ) } +static void unfilled_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + /** * Create unfilled triangle stage. */ @@ -186,6 +193,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw ) unfilled->stage.tri = unfilled_tri; unfilled->stage.end = unfilled_end; unfilled->stage.reset_stipple_counter = unfilled_reset_stipple_counter; + unfilled->stage.destroy = unfilled_destroy; return &unfilled->stage; } diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/mesa/pipe/draw/draw_validate.c index 4e8f986b272..8ce4a926e22 100644 --- a/src/mesa/pipe/draw/draw_validate.c +++ b/src/mesa/pipe/draw/draw_validate.c @@ -110,6 +110,10 @@ static void validate_begin( struct draw_stage *stage ) } +static void validate_destroy( struct draw_stage *stage ) +{ + FREE( stage ); +} /** @@ -127,6 +131,7 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw ) stage->tri = NULL; stage->end = NULL; stage->reset_stipple_counter = NULL; + stage->destroy = validate_destroy; return stage; } diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c index d00cdec56c6..d010aaba076 100644 --- a/src/mesa/pipe/draw/draw_vbuf.c +++ b/src/mesa/pipe/draw/draw_vbuf.c @@ -369,6 +369,15 @@ vbuf_reset_stipple_counter( struct draw_stage *stage ) } +static void vbuf_destroy( struct draw_stage *stage ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + FREE( vbuf->indices ); + FREE( stage ); +} + + /** * Create a new primitive vbuf/render stage. */ @@ -384,12 +393,12 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw, vbuf->stage.tri = vbuf_first_tri; vbuf->stage.end = vbuf_end; vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter; + vbuf->stage.destroy = vbuf_destroy; vbuf->render = render; assert(render->max_indices < UNDEFINED_VERTEX_ID); vbuf->max_indices = render->max_indices; - /* FIXME: free this memory on takedown */ vbuf->indices = MALLOC( vbuf->max_indices ); vbuf->vertices = NULL; diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c index 494a2bc6199..a56c9b88939 100644 --- a/src/mesa/pipe/draw/draw_wide_prims.c +++ b/src/mesa/pipe/draw/draw_wide_prims.c @@ -315,7 +315,6 @@ static void wide_begin( struct draw_stage *stage ) } - static void wide_end( struct draw_stage *stage ) { stage->next->end( stage->next ); @@ -327,6 +326,14 @@ static void draw_reset_stipple_counter( struct draw_stage *stage ) stage->next->reset_stipple_counter( stage->next ); } + +static void wide_destroy( struct draw_stage *stage ) +{ + draw_free_tmps( stage ); + FREE( stage ); +} + + struct draw_stage *draw_wide_stage( struct draw_context *draw ) { struct wide_stage *wide = CALLOC_STRUCT(wide_stage); @@ -341,6 +348,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw ) wide->stage.tri = passthrough_tri; wide->stage.end = wide_end; wide->stage.reset_stipple_counter = draw_reset_stipple_counter; + wide->stage.destroy = wide_destroy; return &wide->stage; } diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/mesa/pipe/i915simple/i915_prim_emit.c index 0a8be79ae47..c50a5915899 100644 --- a/src/mesa/pipe/i915simple/i915_prim_emit.c +++ b/src/mesa/pipe/i915simple/i915_prim_emit.c @@ -194,6 +194,11 @@ static void reset_stipple_counter( struct draw_stage *stage ) { } +static void render_destroy( struct draw_stage *stage ) +{ + FREE( stage ); +} + /** * Create a new primitive setup/render stage. This gets plugged into @@ -211,6 +216,7 @@ struct draw_stage *i915_draw_render_stage( struct i915_context *i915 ) setup->stage.tri = setup_tri; setup->stage.end = setup_end; setup->stage.reset_stipple_counter = reset_stipple_counter; + setup->stage.destroy = render_destroy; return &setup->stage; } diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index 9f5a43a8278..6980564bdc8 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -1124,6 +1124,12 @@ static void reset_stipple_counter( struct draw_stage *stage ) } +static void render_destroy( struct draw_stage *stage ) +{ + FREE( stage ); +} + + /** * Create a new primitive setup/render stage. */ @@ -1139,6 +1145,7 @@ struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe ) setup->stage.tri = setup_tri; setup->stage.end = setup_end; setup->stage.reset_stipple_counter = reset_stipple_counter; + setup->stage.destroy = render_destroy; setup->quad.coef = setup->coef; diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c index 59cf1c4eb75..2cfdeb58090 100644 --- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c +++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c @@ -275,6 +275,16 @@ static void reset_stipple_counter( struct draw_stage *stage ) } +static void vbuf_destroy( struct draw_stage *stage ) +{ + struct vbuf_stage *vbuf = vbuf_stage( stage ); + + FREE( vbuf->element_map ); + FREE( vbuf->vertex_map ); + FREE( stage ); +} + + /** * Create a new primitive vbuf/render stage. */ @@ -290,6 +300,7 @@ struct draw_stage *sp_draw_vbuf_stage( struct draw_context *draw_context, vbuf->stage.tri = vbuf_first_tri; vbuf->stage.end = vbuf_end; vbuf->stage.reset_stipple_counter = reset_stipple_counter; + vbuf->stage.destroy = vbuf_destroy; vbuf->pipe = pipe; vbuf->draw = draw; diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index dd11dd58b78..d036e9d3836 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -1808,7 +1808,7 @@ exec_instruction( micro_sub( &r[2], &r[2], &r[5] ); if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) { - STORE( &r[2], 0, CHAN_X ); + STORE( &r[2], 0, CHAN_X ); } FETCH(&r[2], 1, CHAN_X); @@ -1821,7 +1821,7 @@ exec_instruction( micro_sub( &r[3], &r[3], &r[1] ); if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) { - STORE( &r[3], 0, CHAN_Y ); + STORE( &r[3], 0, CHAN_Y ); } micro_mul( &r[5], &r[5], &r[4] ); @@ -1829,11 +1829,11 @@ exec_instruction( micro_sub( &r[5], &r[5], &r[0] ); if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) { - STORE( &r[5], 0, CHAN_Z ); + STORE( &r[5], 0, CHAN_Z ); } if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) { - STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W ); + STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W ); } break; |