From 6463b94973912c2c7f056132e8744db0dc98c6b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 3 Nov 2013 20:27:28 +0100 Subject: [PATCH] r600g: properly unbind a DSA state being deleted in r600_delete_dsa_state MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested-by: Christian König --- src/gallium/drivers/r600/r600_pipe.h | 2 +- src/gallium/drivers/r600/r600_state_common.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 6aa944c54a0..d7af6180641 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -538,7 +538,7 @@ static INLINE void r600_set_cso_state_with_cb(struct r600_cso_state *state, void struct r600_command_buffer *cb) { state->cb = cb; - state->atom.num_dw = cb->num_dw; + state->atom.num_dw = cb ? cb->num_dw : 0; r600_set_cso_state(state, cso); } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 8f164bf1891..7d3c5bc20a7 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -269,8 +269,10 @@ static void r600_bind_dsa_state(struct pipe_context *ctx, void *state) struct r600_dsa_state *dsa = state; struct r600_stencil_ref ref; - if (state == NULL) + if (state == NULL) { + r600_set_cso_state_with_cb(&rctx->dsa_state, NULL, NULL); return; + } r600_set_cso_state_with_cb(&rctx->dsa_state, dsa, &dsa->buffer); @@ -458,8 +460,13 @@ static void r600_delete_blend_state(struct pipe_context *ctx, void *state) static void r600_delete_dsa_state(struct pipe_context *ctx, void *state) { + struct r600_context *rctx = (struct r600_context *)ctx; struct r600_dsa_state *dsa = (struct r600_dsa_state *)state; + if (rctx->dsa_state.cso == state) { + ctx->bind_depth_stencil_alpha_state(ctx, NULL); + } + r600_release_command_buffer(&dsa->buffer); free(dsa); } -- 2.30.2