radeonsi: unbind blend/DSA/rasterizer state correctly in delete functions
authorMarek Olšák <marek.olsak@amd.com>
Mon, 19 Aug 2019 18:37:33 +0000 (14:37 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 27 Aug 2019 20:52:30 +0000 (16:52 -0400)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111414

Fixes: b758eed9c37 ("radeonsi: make sure that blend state != NULL and remove all NULL checking")
Cc: 19.2 <mesa-stable@lists.freedesktop.org>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/radeonsi/si_state.c

index 86ca4bac57a508c1471068748fd1574e899dfb91..a1e4a5b9cee28fa0c559d4a5092d8477da1d2e30 100644 (file)
@@ -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);
 }
 
@@ -1091,7 +1095,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);
@@ -1335,6 +1339,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);
 }