summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2014-01-08 01:25:14 +0100
committerMarek Olšák <marek.olsak@amd.com>2014-01-13 15:48:08 +0100
commita86de9a72f229e1833af93f5d51023a1dec3af1e (patch)
treef4a5714cb9ce789989007a2c838683cca9a6a9b9
parent9677cfab323ef0a24b40711895333685c63258ac (diff)
radeonsi: handle NULL colorbuffers correctly
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 3666a1106f..ba73401690 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2102,8 +2102,15 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
rctx->export_16bpc = 0;
rctx->fb_compressed_cb_mask = 0;
for (i = 0; i < state->nr_cbufs; i++) {
- struct r600_texture *rtex =
- (struct r600_texture*)state->cbufs[i]->texture;
+ struct r600_texture *rtex;
+
+ if (!state->cbufs[i]) {
+ si_pm4_set_reg(pm4, R_028C70_CB_COLOR0_INFO + i * 0x3C,
+ S_028C70_FORMAT(V_028C70_COLOR_INVALID));
+ continue;
+ }
+
+ rtex = (struct r600_texture*)state->cbufs[i]->texture;
si_cb(rctx, pm4, state, i);
@@ -2136,16 +2143,11 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
si_pm4_set_reg(pm4, R_028204_PA_SC_WINDOW_SCISSOR_TL, tl);
si_pm4_set_reg(pm4, R_028208_PA_SC_WINDOW_SCISSOR_BR, br);
- if (state->nr_cbufs)
- nr_samples = state->cbufs[0]->texture->nr_samples;
- else if (state->zsbuf)
- nr_samples = state->zsbuf->texture->nr_samples;
- else
- nr_samples = 0;
+ nr_samples = util_framebuffer_get_num_samples(state);
si_set_msaa_state(rctx, pm4, nr_samples);
rctx->fb_log_samples = util_logbase2(nr_samples);
- rctx->fb_cb0_is_integer = state->nr_cbufs &&
+ rctx->fb_cb0_is_integer = state->nr_cbufs && state->cbufs[0] &&
util_format_is_pure_integer(state->cbufs[0]->format);
si_pm4_set_state(rctx, framebuffer, pm4);