diff options
author | Brian <[email protected]> | 2008-03-22 09:12:52 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2008-03-22 09:12:52 -0600 |
commit | 0b60ade834dd09ba806f8b5dd2dfed25469a8c8e (patch) | |
tree | fc6c1d6fb287394259fc0ba2cf6364642a522320 /src/mesa | |
parent | 28b3b078959db8a1e60adfb66f35ceb04d4f414d (diff) |
gallium: fix a few mem leaks when deleting programs
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_cb_program.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 0a62e20e0c6..7cf352d710b 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -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; |