fix some additional program refcounting bugs
cherry-picked from master
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 9a23c5d..e06ab5a 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -116,8 +116,6 @@
}
-
-
/**
* Set the vertex/fragment program error state (position and error string).
* This is generally called from within the parsers.
@@ -272,6 +270,7 @@
{
(void) ctx;
ASSERT(prog);
+ ASSERT(prog->RefCount==0);
if (prog == &_mesa_DummyProgram)
return;
@@ -391,7 +390,7 @@
clone->Format = prog->Format;
clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
if (!clone->Instructions) {
- ctx->Driver.DeleteProgram(ctx, clone);
+ _mesa_reference_program(ctx, &clone, NULL);
return NULL;
}
_mesa_copy_instructions(clone->Instructions, prog->Instructions,