mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 12:08:06 +02:00
mesa: Ensure TGSI tokens are freed with gallium's free.
To avoid breaking the gallium's builtin malloc debugging.
This commit is contained in:
parent
9297e6968a
commit
734a498ed4
4 changed files with 20 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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" */
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue