summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-16 09:56:59 -0600
committerBrian Paul <[email protected]>2008-05-16 15:40:44 -0600
commit470f69950577e05e3dfd09653c268cf22c034d7f (patch)
tree09beeee8f5cf1b9ec317d753b23946b7ce5bfe0e /src/mesa/shader/shader_api.c
parentffbd455a36f1d7600bd5b60e91768133d901d2f4 (diff)
Fix a program refcounting error, don't share program parameter lists.
The refcounting bug was causing a memleak (unfreed programs). The old parameter list sharing is not needed since the change in how uniforms are handled.
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index badc457c1c0..fbaaf8ddea5 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -75,21 +75,8 @@ void
_mesa_clear_shader_program_data(GLcontext *ctx,
struct gl_shader_program *shProg)
{
- if (shProg->VertexProgram) {
- /* Set ptr to NULL since the param list is shared with the
- * original/unlinked program.
- */
- shProg->VertexProgram->Base.Parameters = NULL;
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
- }
-
- if (shProg->FragmentProgram) {
- /* Set ptr to NULL since the param list is shared with the
- * original/unlinked program.
- */
- shProg->FragmentProgram->Base.Parameters = NULL;
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
- }
+ _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
+ _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
if (shProg->Uniforms) {
_mesa_free_uniform_list(shProg->Uniforms);
@@ -176,8 +163,10 @@ _mesa_reference_shader_program(GLcontext *ctx,
ASSERT(old->RefCount > 0);
old->RefCount--;
- /*printf("SHPROG DECR %p (%d) to %d\n",
- (void*) old, old->Name, old->RefCount);*/
+#if 0
+ printf("ShaderProgram %p ID=%u RefCount-- to %d\n",
+ (void *) old, old->Name, old->RefCount);
+#endif
deleteFlag = (old->RefCount == 0);
if (deleteFlag) {
@@ -191,8 +180,10 @@ _mesa_reference_shader_program(GLcontext *ctx,
if (shProg) {
shProg->RefCount++;
- /*printf("SHPROG INCR %p (%d) to %d\n",
- (void*) shProg, shProg->Name, shProg->RefCount);*/
+#if 0
+ printf("ShaderProgram %p ID=%u RefCount++ to %d\n",
+ (void *) shProg, shProg->Name, shProg->RefCount);
+#endif
*ptr = shProg;
}
}