diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c index c710a1e2e7a..22b6e3ad518 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.c +++ b/src/gallium/drivers/radeonsi/si_pm4.c @@ -99,8 +99,14 @@ void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsi if (!state) return; - if (idx != ~0 && sctx->emitted.array[idx] == state) { - sctx->emitted.array[idx] = NULL; + if (idx != ~0) { + if (sctx->emitted.array[idx] == state) + sctx->emitted.array[idx] = NULL; + + if (sctx->queued.array[idx] == state) { + sctx->queued.array[idx] = NULL; + sctx->dirty_states &= ~BITFIELD_BIT(idx); + } } si_pm4_clear_state(state); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index d8b0a14cffe..f9d1bcdd407 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -485,12 +485,7 @@ struct si_buffer_resources { } while (0) #define si_pm4_delete_state(sctx, member, value) \ - do { \ - if ((sctx)->queued.named.member == (value)) { \ - (sctx)->queued.named.member = NULL; \ - } \ - si_pm4_free_state(sctx, (struct si_pm4_state *)(value), SI_STATE_IDX(member)); \ - } while (0) + si_pm4_free_state(sctx, (struct si_pm4_state *)(value), SI_STATE_IDX(member)) /* si_descriptors.c */ void si_set_mutable_tex_desc_fields(struct si_screen *sscreen, struct si_texture *tex,