radeonsi: fix occlusion queries with 16x AA without FBO attachments on Stoney
authorMarek Olšák <marek.olsak@amd.com>
Wed, 20 Jun 2018 23:43:36 +0000 (18:43 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 21 Jun 2018 18:42:14 +0000 (14:42 -0400)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/gallium/drivers/radeonsi/si_state.c

index cfe32bc7f5edd0bb0086f1bd1a3b02bfa8f59b40..a7377f387453f04c76b7f2563a112fc22a194391 100644 (file)
@@ -1378,9 +1378,17 @@ static void si_emit_db_render_state(struct si_context *sctx)
                bool perfect = sctx->num_perfect_occlusion_queries > 0;
 
                if (sctx->chip_class >= CIK) {
+                       unsigned log_sample_rate = sctx->framebuffer.log_samples;
+
+                       /* Stoney doesn't increment occlusion query counters
+                        * if the sample rate is 16x. Use 8x sample rate instead.
+                        */
+                       if (sctx->family == CHIP_STONEY)
+                               log_sample_rate = MIN2(log_sample_rate, 3);
+
                        db_count_control =
                                S_028004_PERFECT_ZPASS_COUNTS(perfect) |
-                               S_028004_SAMPLE_RATE(sctx->framebuffer.log_samples) |
+                               S_028004_SAMPLE_RATE(log_sample_rate) |
                                S_028004_ZPASS_ENABLE(1) |
                                S_028004_SLICE_EVEN_ENABLE(1) |
                                S_028004_SLICE_ODD_ENABLE(1);