summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_program.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-09-27 23:36:59 +0200
committerMarek Olšák <[email protected]>2015-10-20 12:51:51 +0200
commitf4e938e9aee14d42e2175c84ebe7ee32b0bcf8c5 (patch)
treeec7c46f2678848312c90bc8e12608cc633f5f493 /src/mesa/state_tracker/st_program.c
parentd74e7b6fb9dca5622c17413821d4cfcc67472e76 (diff)
st/mesa: decouple shaders from contexts if they are shareable
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_program.c')
-rw-r--r--src/mesa/state_tracker/st_program.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 6a69ba7aa26..87571a88e78 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -1728,6 +1728,12 @@ destroy_program_variants_cb(GLuint key, void *data, void *userData)
void
st_destroy_program_variants(struct st_context *st)
{
+ /* If shaders can be shared with other contexts, the last context will
+ * call DeleteProgram on all shaders, releasing everything.
+ */
+ if (st->has_shareable_shaders)
+ return;
+
/* ARB vert/frag program */
_mesa_HashWalk(st->ctx->Shared->Programs,
destroy_program_variants_cb, st);
@@ -1774,7 +1780,7 @@ st_precompile_shader_variant(struct st_context *st,
struct st_vp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_vp_variant(st, p, &key);
break;
}
@@ -1784,7 +1790,7 @@ st_precompile_shader_variant(struct st_context *st,
struct st_tcp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_tcp_variant(st, p, &key);
break;
}
@@ -1794,7 +1800,7 @@ st_precompile_shader_variant(struct st_context *st,
struct st_tep_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_tep_variant(st, p, &key);
break;
}
@@ -1804,7 +1810,7 @@ st_precompile_shader_variant(struct st_context *st,
struct st_gp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_gp_variant(st, p, &key);
break;
}
@@ -1814,7 +1820,7 @@ st_precompile_shader_variant(struct st_context *st,
struct st_fp_variant_key key;
memset(&key, 0, sizeof(key));
- key.st = st;
+ key.st = st->has_shareable_shaders ? NULL : st;
st_get_fp_variant(st, p, &key);
break;
}