From: Marek Olšák Date: Wed, 29 May 2019 02:29:08 +0000 (-0400) Subject: radeonsi/gfx10: unbind NGG shaders when destroyed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc7875150a5431800e811c31f99979c5a88a6deb;p=mesa.git radeonsi/gfx10: unbind NGG shaders when destroyed This fixes glsl-max-varyings, which creates shaders, draws, and then destroys them. Acked-by: Bas Nieuwenhuizen --- diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 7922ced414d..aa98a209cec 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -3040,6 +3040,11 @@ static void si_delete_shader(struct si_context *sctx, struct si_shader *shader) util_queue_fence_destroy(&shader->ready); if (shader->pm4) { + /* If destroyed shaders were not unbound, the next compiled + * shader variant could get the same pointer address and so + * binding it to the same shader stage would be considered + * a no-op, causing random behavior. + */ switch (shader->selector->type) { case PIPE_SHADER_VERTEX: if (shader->key.as_ls) { @@ -3048,6 +3053,8 @@ static void si_delete_shader(struct si_context *sctx, struct si_shader *shader) } else if (shader->key.as_es) { assert(sctx->chip_class <= GFX8); si_pm4_delete_state(sctx, es, shader->pm4); + } else if (shader->key.as_ngg) { + si_pm4_delete_state(sctx, gs, shader->pm4); } else { si_pm4_delete_state(sctx, vs, shader->pm4); } @@ -3059,6 +3066,8 @@ static void si_delete_shader(struct si_context *sctx, struct si_shader *shader) if (shader->key.as_es) { assert(sctx->chip_class <= GFX8); si_pm4_delete_state(sctx, es, shader->pm4); + } else if (shader->key.as_ngg) { + si_pm4_delete_state(sctx, gs, shader->pm4); } else { si_pm4_delete_state(sctx, vs, shader->pm4); }