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

Marek Olšák maraeo at gmail.com
Thu Oct 22 16:12:19 PDT 2015


From: Marek Olšák <marek.olsak at 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(-)

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;
-- 
2.1.4



More information about the mesa-dev mailing list