From dc05a9e4e089d66a2ffe8919857ad9660e108c28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 18 Sep 2014 23:48:04 +0200 Subject: [PATCH] radeonsi: properly destroy the GS copy shader and scratch_bo for compute MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Cc: 10.2 10.3 Reviewed-by: Michel Dänzer --- src/gallium/drivers/radeonsi/si_shader.c | 4 ++++ src/gallium/drivers/radeonsi/si_state.c | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 72618852430..9d2cc803c2d 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2973,5 +2973,9 @@ out: void si_shader_destroy(struct pipe_context *ctx, struct si_shader *shader) { + if (shader->gs_copy_shader) + si_shader_destroy(ctx, shader->gs_copy_shader); + r600_resource_reference(&shader->bo, NULL); + r600_resource_reference(&shader->scratch_bo, NULL); } diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 2aa9aad2e07..ed90f13a074 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2403,9 +2403,10 @@ static void si_delete_shader_selector(struct pipe_context *ctx, while (p) { c = p->next_variant; - if (sel->type == PIPE_SHADER_GEOMETRY) + if (sel->type == PIPE_SHADER_GEOMETRY) { si_pm4_delete_state(sctx, gs, p->pm4); - else if (sel->type == PIPE_SHADER_FRAGMENT) + si_pm4_delete_state(sctx, vs, p->gs_copy_shader->pm4); + } else if (sel->type == PIPE_SHADER_FRAGMENT) si_pm4_delete_state(sctx, ps, p->pm4); else if (p->key.vs.as_es) si_pm4_delete_state(sctx, es, p->pm4); @@ -2418,7 +2419,7 @@ static void si_delete_shader_selector(struct pipe_context *ctx, free(sel->tokens); free(sel); - } +} static void si_delete_vs_shader(struct pipe_context *ctx, void *state) { -- 2.30.2