diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-05-07 08:55:33 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-05-07 08:55:33 -0600 |
commit | a56a59ce74b7f18f25a13992d2a2c1ae7cf973ce (patch) | |
tree | 77480d5ff607adcfa5c7688805c514e4ab5c51e3 /src/mesa/shader/shader_api.c | |
parent | 10b7192747087ec25f97cdfcfc062654a2d8fe6d (diff) |
gallium: implement full reference counting for vertex/fragment programs
Use _mesa_reference_vert/fragprog() wherever we assign program pointers.
Fixes a memory corruption bug found with glean/api2 test.
Another memory bug involving shaders yet to be fixed...
Picked from gallium-0.1
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r-- | src/mesa/shader/shader_api.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 9c419c9903..f12fa28d97 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -80,8 +80,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, * original/unlinked program. */ shProg->VertexProgram->Base.Parameters = NULL; - ctx->Driver.DeleteProgram(ctx, &shProg->VertexProgram->Base); - shProg->VertexProgram = NULL; + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); } if (shProg->FragmentProgram) { @@ -89,8 +88,7 @@ _mesa_clear_shader_program_data(GLcontext *ctx, * original/unlinked program. */ shProg->FragmentProgram->Base.Parameters = NULL; - ctx->Driver.DeleteProgram(ctx, &shProg->FragmentProgram->Base); - shProg->FragmentProgram = NULL; + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); } if (shProg->Uniforms) { |