[Mesa-dev,7/7] radeonsi: don't unbind shaders in delete_shader_selector

Submitted by Marek Olšák on Oct. 22, 2015, 11:12 p.m.

Details

Message ID 1445555539-26595-8-git-send-email-maraeo@gmail.com
State New
Headers show
Series "RadeonSI: Unbind shaders properly" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Marek Olšák Oct. 22, 2015, 11:12 p.m.
From: Marek Olšák <marek.olsak@amd.com>

It's moot with shaders that any context can use and release.
---
 src/gallium/drivers/radeonsi/si_shader.c        |  3 ++
 src/gallium/drivers/radeonsi/si_state_shaders.c | 40 -------------------------
 2 files changed, 3 insertions(+), 40 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index a119cbd..fe1ca67 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4253,6 +4253,9 @@  void si_shader_destroy(struct si_shader *shader)
 		FREE(shader->gs_copy_shader);
 	}
 
+        if (shader->pm4)
+           si_pm4_free_state_simple(shader->pm4);
+
 	if (shader->scratch_bo)
 		r600_resource_reference(&shader->scratch_bo, NULL);
 
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 478b851..3e44451 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -914,51 +914,11 @@  static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
 
 static void si_delete_shader_selector(struct pipe_context *ctx, void *state)
 {
-	struct si_context *sctx = (struct si_context *)ctx;
 	struct si_shader_selector *sel = (struct si_shader_selector *)state;
 	struct si_shader *p = sel->first_variant, *c;
-	struct si_shader_ctx_state *current_shader[SI_NUM_SHADERS] = {
-		[PIPE_SHADER_VERTEX] = &sctx->vs_shader,
-		[PIPE_SHADER_TESS_CTRL] = &sctx->tcs_shader,
-		[PIPE_SHADER_TESS_EVAL] = &sctx->tes_shader,
-		[PIPE_SHADER_GEOMETRY] = &sctx->gs_shader,
-		[PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
-	};
-
-	if (current_shader[sel->type]->cso == sel) {
-		current_shader[sel->type]->cso = NULL;
-		current_shader[sel->type]->current = NULL;
-	}
 
 	while (p) {
 		c = p->next_variant;
-		switch (sel->type) {
-		case PIPE_SHADER_VERTEX:
-			if (p->key.vs.as_ls)
-				si_pm4_delete_state(sctx, ls, p->pm4);
-			else if (p->key.vs.as_es)
-				si_pm4_delete_state(sctx, es, p->pm4);
-			else
-				si_pm4_delete_state(sctx, vs, p->pm4);
-			break;
-		case PIPE_SHADER_TESS_CTRL:
-			si_pm4_delete_state(sctx, hs, p->pm4);
-			break;
-		case PIPE_SHADER_TESS_EVAL:
-			if (p->key.tes.as_es)
-				si_pm4_delete_state(sctx, es, p->pm4);
-			else
-				si_pm4_delete_state(sctx, vs, p->pm4);
-			break;
-		case PIPE_SHADER_GEOMETRY:
-			si_pm4_delete_state(sctx, gs, p->pm4);
-			si_pm4_delete_state(sctx, vs, p->gs_copy_shader->pm4);
-			break;
-		case PIPE_SHADER_FRAGMENT:
-			si_pm4_delete_state(sctx, ps, p->pm4);
-			break;
-		}
-
 		si_shader_destroy(p);
 		free(p);
 		p = c;