aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_context.c12
-rw-r--r--src/mesa/state_tracker/st_program.c13
-rw-r--r--src/mesa/state_tracker/st_program.h3
3 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index fa309436408..645c02f3dfd 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -1070,12 +1070,12 @@ st_destroy_context(struct st_context *st)
simple_mtx_destroy(&st->zombie_sampler_views.mutex);
simple_mtx_destroy(&st->zombie_shaders.mutex);
- st_reference_prog(st, &st->fp, NULL);
- st_reference_prog(st, &st->gp, NULL);
- st_reference_prog(st, &st->vp, NULL);
- st_reference_prog(st, &st->tcp, NULL);
- st_reference_prog(st, &st->tep, NULL);
- st_reference_prog(st, &st->cp, NULL);
+ st_release_program(st, &st->fp);
+ st_release_program(st, &st->gp);
+ st_release_program(st, &st->vp);
+ st_release_program(st, &st->tcp);
+ st_release_program(st, &st->tep);
+ st_release_program(st, &st->cp);
/* release framebuffer in the winsys buffers list */
LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) {
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 466c3f1a29e..c0e63b8a98c 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -334,6 +334,19 @@ st_release_variants(struct st_context *st, struct st_program *p)
*/
}
+/**
+ * Free all basic program variants and unref program.
+ */
+void
+st_release_program(struct st_context *st, struct st_program **p)
+{
+ if (!*p)
+ return;
+
+ st_release_variants(st, *p);
+ st_reference_prog(st, p, NULL);
+}
+
void
st_finalize_nir_before_variants(struct nir_shader *nir)
{
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 87ac3388d72..286fabc0117 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -318,6 +318,9 @@ extern void
st_release_variants(struct st_context *st, struct st_program *p);
extern void
+st_release_program(struct st_context *st, struct st_program **p);
+
+extern void
st_destroy_program_variants(struct st_context *st);
extern void