From 2abbd494f8909cf66797cf78966ae672cf7dd47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 19 Aug 2019 14:37:33 -0400 Subject: [PATCH] radeonsi: unbind blend/DSA/rasterizer state correctly in delete functions Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111414 Cc: 19.2 --- src/gallium/drivers/radeonsi/si_state.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 12636dbeab7..66d683f0619 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -715,6 +715,10 @@ static void si_bind_blend_state(struct pipe_context *ctx, void *state) static void si_delete_blend_state(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; + + if (sctx->queued.named.blend == state) + si_bind_blend_state(ctx, sctx->noop_blend); + si_pm4_delete_state(sctx, blend, (struct si_state_blend *)state); } @@ -1083,7 +1087,7 @@ static void si_delete_rs_state(struct pipe_context *ctx, void *state) struct si_state_rasterizer *rs = (struct si_state_rasterizer *)state; if (sctx->queued.named.rasterizer == state) - si_pm4_bind_state(sctx, poly_offset, NULL); + si_bind_rs_state(ctx, sctx->discard_rasterizer_state); FREE(rs->pm4_poly_offset); si_pm4_delete_state(sctx, rasterizer, rs); @@ -1327,6 +1331,10 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state) static void si_delete_dsa_state(struct pipe_context *ctx, void *state) { struct si_context *sctx = (struct si_context *)ctx; + + if (sctx->queued.named.dsa == state) + si_bind_dsa_state(ctx, sctx->noop_dsa); + si_pm4_delete_state(sctx, dsa, (struct si_state_dsa *)state); } -- 2.17.1