summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/prog_cache.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/prog_cache.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/prog_cache.c')
-rw-r--r--src/mesa/shader/prog_cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/shader/prog_cache.c
index dd0241ef24e..36a25377c55 100644
--- a/src/mesa/shader/prog_cache.c
+++ b/src/mesa/shader/prog_cache.c
@@ -30,6 +30,7 @@
#include "main/mtypes.h"
#include "main/imports.h"
#include "shader/prog_cache.h"
+#include "shader/program.h"
struct cache_item
@@ -109,7 +110,7 @@ clear_cache(GLcontext *ctx, struct gl_program_cache *cache)
for (c = cache->items[i]; c; c = next) {
next = c->next;
_mesa_free(c->key);
- ctx->Driver.DeleteProgram(ctx, c->program);
+ _mesa_reference_program(ctx, &c->program, NULL);
_mesa_free(c);
}
cache->items[i] = NULL;
@@ -177,7 +178,7 @@ _mesa_program_cache_insert(GLcontext *ctx,
c->key = _mesa_malloc(keysize);
memcpy(c->key, key, keysize);
- c->program = program;
+ c->program = program; /* no refcount change */
if (cache->n_items > cache->size * 1.5) {
if (cache->size < 1000)