Module: Mesa Branch: gallium-0.1 Commit: 26fba839724dd5d1120103a203bd3ab9c212009b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=26fba839724dd5d1120103a203bd3ab9c212009b
Author: José Fonseca <[email protected]> Date: Thu Feb 19 13:02:47 2009 +0000 mesa: Free the util shaders with the gallium's FREE. --- src/gallium/auxiliary/util/u_simple_shaders.c | 7 +++++++ src/gallium/auxiliary/util/u_simple_shaders.h | 4 ++++ src/mesa/state_tracker/st_atom_shader.c | 2 +- src/mesa/state_tracker/st_cb_bitmap.c | 1 + src/mesa/state_tracker/st_cb_clear.c | 6 +++--- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index f06d13c..5d78682 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -359,3 +359,10 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe, return pipe->create_fs_state(pipe, shader); } + +void +util_free_shader(struct pipe_shader_state *shader) +{ + FREE((struct tgsi_token *)shader->tokens); + shader->tokens = NULL; +} diff --git a/src/gallium/auxiliary/util/u_simple_shaders.h b/src/gallium/auxiliary/util/u_simple_shaders.h index 8ca4977..99b8d90 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.h +++ b/src/gallium/auxiliary/util/u_simple_shaders.h @@ -60,6 +60,10 @@ util_make_fragment_passthrough_shader(struct pipe_context *pipe, struct pipe_shader_state *shader); +extern void +util_free_shader(struct pipe_shader_state *shader); + + #ifdef __cplusplus } #endif diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index cbd414e..1e434ea 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -313,7 +313,7 @@ get_passthrough_fs(struct st_context *st) st->passthrough_fs = util_make_fragment_passthrough_shader(st->pipe, &shader); #if 0 /* We actually need to keep the tokens around at this time */ - free((void *) shader.tokens); + util_free_shader(&shader); #endif } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index bc05ca6..6412c2c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -819,6 +819,7 @@ st_destroy_bitmap(struct st_context *st) cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); st->bitmap.vs = NULL; } + util_free_shader(&st->bitmap.vert_shader); if (st->bitmap.vbuf) { pipe_buffer_destroy(pipe->screen, st->bitmap.vbuf); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index b6cea16..8266604 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -98,12 +98,12 @@ st_destroy_clear(struct st_context *st) struct pipe_context *pipe = st->pipe; if (st->clear.vert_shader.tokens) { - FREE((void *) st->clear.vert_shader.tokens); + util_free_shader(&st->clear.vert_shader); st->clear.vert_shader.tokens = NULL; } if (st->clear.frag_shader.tokens) { - FREE((void *) st->clear.frag_shader.tokens); + util_free_shader(&st->clear.frag_shader); st->clear.frag_shader.tokens = NULL; } @@ -116,7 +116,7 @@ st_destroy_clear(struct st_context *st) st->clear.vs = NULL; } if (st->clear.vbuf) { - pipe_buffer_destroy(pipe->screen, st->clear.vbuf); + pipe_buffer_reference(pipe->screen, &st->clear.vbuf, NULL); st->clear.vbuf = NULL; } } _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
