From: Marek Olšák Date: Wed, 16 May 2018 02:04:20 +0000 (-0400) Subject: radeonsi: set DB_EQAA.MAX_ANCHOR_SAMPLES correctly X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=508b423dd6f08591a911f83e7a798027ab0021c0;p=mesa.git radeonsi: set DB_EQAA.MAX_ANCHOR_SAMPLES correctly Tested-by: Dieter Nützel Reviewed-by: Nicolai Hähnle --- 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));