diff options
author | Marek Olšák <[email protected]> | 2015-02-15 18:12:06 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-02-17 17:41:00 +0100 |
commit | 2ead74888a70481aa40b5b6ede42279e1917e66c (patch) | |
tree | 4f0b47051420e602da6b94f5c8276a79b92a68c5 /src/gallium/drivers/radeonsi/si_state.c | |
parent | 7713d594e4fbb9afb1ac67417b7871d436590548 (diff) |
radeonsi: fix a crash if a stencil ref state is set before a DSA state
+ minor indentation fixes
Discovered by Axel Davy.
This can't be reproduced with any app, because all state trackers set a DSA
state first.
Cc: 10.5 10.4 10.3 <[email protected]>
Reviewed-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index fb353ad419d..3eea0b6c18a 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -735,12 +735,16 @@ static void si_delete_rs_state(struct pipe_context *ctx, void *state) */ static void si_update_dsa_stencil_ref(struct si_context *sctx) { - struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state); + struct si_pm4_state *pm4; struct pipe_stencil_ref *ref = &sctx->stencil_ref; - struct si_state_dsa *dsa = sctx->queued.named.dsa; + struct si_state_dsa *dsa = sctx->queued.named.dsa; - if (pm4 == NULL) - return; + if (!dsa) + return; + + pm4 = CALLOC_STRUCT(si_pm4_state); + if (pm4 == NULL) + return; si_pm4_set_reg(pm4, R_028430_DB_STENCILREFMASK, S_028430_STENCILTESTVAL(ref->ref_value[0]) | |