summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-11-03 20:27:28 +0100
committerMarek Olšák <[email protected]>2013-11-04 19:07:57 +0100
commit6463b94973912c2c7f056132e8744db0dc98c6b8 (patch)
tree6df1e3400ed2b3cf0e8e26561fa2b564ef1d864b /src/gallium
parentf0733479f06c0e6d6b36b863982329455aaf39af (diff)
r600g: properly unbind a DSA state being deleted in r600_delete_dsa_state
Tested-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h2
-rw-r--r--src/gallium/drivers/r600/r600_state_common.c9
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);
}