[Mesa-dev] [PATCH 4/4] radeonsi: emit sample locations also when nr_samples == 1

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 16 09:42:55 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Since the state tracker now enables MSAA in the hardware for the case
nr_samples == 1 as well, we need to set sample locations correctly for
this case.

The Polaris override is still needed for the non-MSAA case (when
nr_samples == 0).
---
 src/gallium/drivers/radeonsi/si_state.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index c64bb5b..818a393 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2625,21 +2625,24 @@ static void si_emit_msaa_sample_locs(struct si_context *sctx,
 
 	/* Smoothing (only possible with nr_samples == 1) uses the same
 	 * sample locations as the MSAA it simulates.
 	 */
 	if (nr_samples <= 1 && sctx->smoothing_enabled)
 		nr_samples = SI_NUM_SMOOTH_AA_SAMPLES;
 
 	/* On Polaris, the small primitive filter uses the sample locations
 	 * even when MSAA is off, so we need to make sure they're set to 0.
 	 */
-	if ((nr_samples > 1 || sctx->b.family >= CHIP_POLARIS10) &&
+	if (sctx->b.family >= CHIP_POLARIS10)
+		nr_samples = MAX2(nr_samples, 1);
+
+	if (nr_samples >= 1 &&
 	    (nr_samples != sctx->msaa_sample_locs.nr_samples)) {
 		sctx->msaa_sample_locs.nr_samples = nr_samples;
 		cayman_emit_msaa_sample_locs(cs, nr_samples);
 	}
 
 	if (sctx->b.family >= CHIP_POLARIS10) {
 		struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 		unsigned small_prim_filter_cntl =
 			S_028830_SMALL_PRIM_FILTER_ENABLE(1) |
 			S_028830_LINE_FILTER_DISABLE(1); /* line bug */
-- 
2.7.4



More information about the mesa-dev mailing list