From 508b423dd6f08591a911f83e7a798027ab0021c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 15 May 2018 22:04:20 -0400 Subject: [PATCH] radeonsi: set DB_EQAA.MAX_ANCHOR_SAMPLES correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Tested-by: Dieter Nützel Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeonsi/si_state.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index f4e29f68b29..3a7e928df53 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3340,7 +3340,7 @@ static void si_emit_msaa_config(struct si_context *sctx) S_028804_INCOHERENT_EQAA_READS(1) | S_028804_INTERPOLATE_COMP_Z(1) | S_028804_STATIC_ANCHOR_ASSOCIATIONS(1); - unsigned coverage_samples, color_samples; + unsigned coverage_samples, color_samples, z_samples; /* S: Coverage samples (up to 16x): * - Scan conversion samples (PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES) @@ -3386,10 +3386,17 @@ static void si_emit_msaa_config(struct si_context *sctx) if (sctx->framebuffer.nr_samples > 1) { coverage_samples = sctx->framebuffer.nr_samples; color_samples = sctx->framebuffer.nr_color_samples; + + if (sctx->framebuffer.state.zsbuf) { + z_samples = sctx->framebuffer.state.zsbuf->texture->nr_samples; + z_samples = MAX2(1, z_samples); + } else { + z_samples = coverage_samples; + } } else if (sctx->smoothing_enabled) { - coverage_samples = color_samples = SI_NUM_SMOOTH_AA_SAMPLES; + coverage_samples = color_samples = z_samples = SI_NUM_SMOOTH_AA_SAMPLES; } else { - coverage_samples = color_samples = 1; + coverage_samples = color_samples = z_samples = 1; } /* Required by OpenGL line rasterization. @@ -3411,6 +3418,7 @@ static void si_emit_msaa_config(struct si_context *sctx) 8, /* 16x MSAA */ }; unsigned log_samples = util_logbase2(coverage_samples); + unsigned log_z_samples = util_logbase2(z_samples); unsigned ps_iter_samples = si_get_ps_iter_samples(sctx); unsigned log_ps_iter_samples = util_logbase2(ps_iter_samples); @@ -3424,7 +3432,7 @@ static void si_emit_msaa_config(struct si_context *sctx) if (sctx->framebuffer.nr_samples > 1) { radeon_set_context_reg(cs, R_028804_DB_EQAA, db_eqaa | - S_028804_MAX_ANCHOR_SAMPLES(log_samples) | + S_028804_MAX_ANCHOR_SAMPLES(log_z_samples) | S_028804_PS_ITER_SAMPLES(log_ps_iter_samples) | S_028804_MASK_EXPORT_NUM_SAMPLES(log_samples) | S_028804_ALPHA_TO_MASK_NUM_SAMPLES(log_samples)); -- 2.30.2