st/mesa: fix shader deletion regression
authorBrian Paul <brianp@vmware.com>
Wed, 9 Feb 2011 01:21:50 +0000 (18:21 -0700)
committerBrian Paul <brianp@vmware.com>
Wed, 9 Feb 2011 01:23:59 +0000 (18:23 -0700)
Fixes a regression from commit 5cbff0932e498f49b57cbb71037b93416bfe30e0.
The problem is *some* glDrawPixels fragment programs need to be deleted,
but not all.  Use an explicit flag to indicate whether or not the program
needs to be deleted.

This should fix http://bugs.freedesktop.org/show_bug.cgi?id=34049

src/mesa/state_tracker/st_program.c

index 174b146ab73bdbbe9ddfbe20a447882375f3aeef..fc1dfb3ef9e618c4952e056d475d44b121a3d6a6 100644 (file)
@@ -406,6 +406,7 @@ st_translate_fragment_program(struct st_context *st,
 {
    struct pipe_context *pipe = st->pipe;
    struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
+   GLboolean deleteFP = GL_FALSE;
 
    if (!variant)
       return NULL;
@@ -422,6 +423,7 @@ st_translate_fragment_program(struct st_context *st,
 
       variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
       stfp = st_fragment_program(fp);
+      deleteFP = GL_TRUE;
    }
    else if (key->drawpixels) {
       /* glDrawPixels drawing */
@@ -435,6 +437,7 @@ st_translate_fragment_program(struct st_context *st,
          /* RGBA */
          st_make_drawpix_fragment_program(st, &stfp->Base, &fp);
          variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
+         deleteFP = GL_TRUE;
       }
       stfp = st_fragment_program(fp);
    }
@@ -632,13 +635,11 @@ st_translate_fragment_program(struct st_context *st,
       debug_printf("\n");
    }
 
-#if FEATURE_drawpix
-   if (key->bitmap || key->drawpixels) {
+   if (deleteFP) {
       /* Free the temporary program made above */
       struct gl_fragment_program *fp = &stfp->Base;
       _mesa_reference_fragprog(st->ctx, &fp, NULL);
    }
-#endif
 
    return variant;
 }