mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 14:40:10 +01:00
gallium: fix a few mem leaks when deleting programs
This commit is contained in:
parent
28b3b07895
commit
0b60ade834
1 changed files with 20 additions and 13 deletions
|
|
@ -126,12 +126,17 @@ static void st_delete_program( GLcontext *ctx,
|
|||
struct gl_program *prog )
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
|
||||
switch( prog->Target ) {
|
||||
case GL_VERTEX_PROGRAM_ARB:
|
||||
{
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
|
||||
st_remove_vertex_program(st, stvp);
|
||||
if (stvp->driver_shader) {
|
||||
pipe->delete_vs_state(pipe, stvp->driver_shader);
|
||||
stvp->driver_shader = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_FRAGMENT_PROGRAM_ARB:
|
||||
|
|
@ -139,6 +144,13 @@ static void st_delete_program( GLcontext *ctx,
|
|||
struct st_fragment_program *stfp
|
||||
= (struct st_fragment_program *) prog;
|
||||
st_remove_fragment_program(st, stfp);
|
||||
if (stfp->driver_shader) {
|
||||
pipe->delete_fs_state(pipe, stfp->driver_shader);
|
||||
stfp->driver_shader = NULL;
|
||||
}
|
||||
|
||||
assert(!stfp->vertex_programs);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -162,19 +174,17 @@ static void st_program_string_notify( GLcontext *ctx,
|
|||
struct gl_program *prog )
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
|
||||
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
|
||||
|
||||
stfp->serialNo++;
|
||||
|
||||
#if 0
|
||||
if (stfp->cso) {
|
||||
/* free the TGSI code */
|
||||
// cso_delete(stfp->vs);
|
||||
stfp->cso = NULL;
|
||||
if (stfp->driver_shader) {
|
||||
pipe->delete_fs_state(pipe, stfp->driver_shader);
|
||||
stfp->driver_shader = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
stfp->param_state = stfp->Base.Base.Parameters->StateFlags;
|
||||
|
||||
|
|
@ -191,14 +201,11 @@ static void st_program_string_notify( GLcontext *ctx,
|
|||
|
||||
stvp->serialNo++;
|
||||
|
||||
#if 0
|
||||
if (stvp->cso) {
|
||||
/* free the CSO data */
|
||||
st->pipe->delete_vs_state(st->pipe, stvp->cso->data);
|
||||
FREE((void *) stvp->cso);
|
||||
stvp->cso = NULL;
|
||||
if (stvp->driver_shader) {
|
||||
pipe->delete_vs_state(pipe, stvp->driver_shader);
|
||||
stvp->driver_shader = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (stvp->draw_shader) {
|
||||
draw_delete_vertex_shader(st->draw, stvp->draw_shader);
|
||||
stvp->draw_shader = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue