summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-05-06 22:13:06 -0600
committerBrian <[email protected]>2008-05-06 22:13:06 -0600
commit103ae5d16fd9fef566096570f731bb634a8025d4 (patch)
tree184578514c317c199b6b05bee1f3c57bf3e19877 /src/mesa/shader/shader_api.c
parent10f6ae0355937615d137c79c060b9e5a923f0d65 (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...
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 9c419c9903f..f12fa28d97b 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) {