}
+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
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;
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 );
}
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.
*/
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;
}
}
+static void feedback_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
+
+
/**
* Create feedback drawing stage.
*/
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;
}
}
+static void flatshade_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create flatshading drawing stage.
*/
flatshade->tri = flatshade_tri;
flatshade->end = flatshade_end;
flatshade->reset_stipple_counter = flatshade_reset_stipple_counter;
+ flatshade->destroy = flatshade_destroy;
return flatshade;
}
}
-
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);
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;
}
}
+static void offset_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create polygon offset drawing stage.
*/
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;
}
void (*reset_tmps)( struct draw_stage * );
void (*reset_stipple_counter)( struct draw_stage * );
+
+ void (*destroy)( struct draw_stage * );
};
}
+static void twoside_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create twoside pipeline stage.
*/
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;
}
}
+static void unfilled_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create unfilled triangle stage.
*/
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;
}
}
+static void validate_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
/**
stage->tri = NULL;
stage->end = NULL;
stage->reset_stipple_counter = NULL;
+ stage->destroy = validate_destroy;
return 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.
*/
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;
}
-
static void wide_end( struct draw_stage *stage )
{
stage->next->end( stage->next );
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);
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;
}
{
}
+static void render_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
+
/**
* Create a new primitive setup/render stage. This gets plugged into
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;
}
}
+static void render_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
+
+
/**
* Create a new primitive setup/render stage.
*/
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;
}
+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.
*/
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;
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);
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] );
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;