diff options
author | José Fonseca <[email protected]> | 2009-09-21 19:57:57 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-09-21 20:12:03 +0100 |
commit | 734a498ed47b35c9e8e7172d19465aca640fa323 (patch) | |
tree | 73f9dc11e179e2bb4a9308b483323786c3fa0fd4 /src/mesa | |
parent | 9297e6968ae16564f3d6a6e78b42da72f9c88e91 (diff) |
mesa: Ensure TGSI tokens are freed with gallium's free.
To avoid breaking the gallium's builtin malloc debugging.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_program.c | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 11 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 2 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 4398ab28392..b2d5c39a3a0 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -45,6 +45,7 @@ #include "st_context.h" #include "st_program.h" #include "st_atom_shader.h" +#include "st_mesa_to_tgsi.h" #include "st_cb_program.h" @@ -152,7 +153,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } } @@ -167,7 +168,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stfp->state.tokens) { - _mesa_free((void *) stfp->state.tokens); + st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } @@ -214,7 +215,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stfp->state.tokens) { - _mesa_free((void *) stfp->state.tokens); + st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } @@ -242,7 +243,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 04be57f8ffa..b0a1b529f1e 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -869,3 +869,14 @@ out: return tokens; } + + +/** + * Tokens cannot be free with _mesa_free otherwise the builtin gallium + * malloc debugging will get confused. + */ +void +st_free_tokens(const struct tgsi_token *tokens) +{ + FREE((void *)tokens); +} diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 679d0ddd41b..c0d1ff59e1f 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -56,6 +56,9 @@ st_translate_mesa_program( const ubyte outputSemanticIndex[], const GLbitfield outputFlags[] ); +void +st_free_tokens(const struct tgsi_token *tokens); + #if defined __cplusplus } /* extern "C" */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 5f9d2a6dad9..927f60cc7e9 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -317,7 +317,7 @@ st_translate_vertex_program(struct st_context *st, /* free old shader state, if any */ if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } if (stvp->driver_shader) { |