summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-05-28 22:29:08 -0400
committerMarek Olšák <[email protected]>2019-07-03 15:51:13 -0400
commitcc7875150a5431800e811c31f99979c5a88a6deb (patch)
tree096f8cad99b3c026dd28d1b8640c1d3771cae369 /src
parentb90ddff4774485ab7fdea35f20e521bd6c7af695 (diff)
radeonsi/gfx10: unbind NGG shaders when destroyed
This fixes glsl-max-varyings, which creates shaders, draws, and then destroys them. Acked-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c9
1 files changed, 9 insertions, 0 deletions
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);
}