radv: Always enable PERFECT_ZPASS_COUNTS.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 5 Jul 2020 16:57:35 +0000 (18:57 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 6 Jul 2020 13:54:38 +0000 (13:54 +0000)
We have an issue with early depth testing and discard, where
non-perfect counts count the tile if the early depth test succeeds.

We could spend a lot of effort to set this conditionally based
on the presence of the two conditions, but in the presence of
inherited queries let's try this first.

Changing PERFECT_ZPASS_COUNTS since I'm pretty sure this has a lower
performance impact than always using late depth testing.

CC: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3218
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5757>

src/amd/vulkan/radv_cmd_buffer.c

index 695aa257c31690127e37d4347209f16c144b6452..5ff1f3121c2f3ee71c04e3233c49bc1d8d64de31 100644 (file)
@@ -2171,8 +2171,11 @@ void radv_set_db_count_control(struct radv_cmd_buffer *cmd_buffer)
                bool gfx10_perfect = cmd_buffer->device->physical_device->rad_info.chip_class >= GFX10 && has_perfect_queries;
 
                if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX7) {
+                       /* Always enable PERFECT_ZPASS_COUNTS due to issues with partially
+                        * covered tiles, discards, and early depth testing. For more details,
+                        * see https://gitlab.freedesktop.org/mesa/mesa/-/issues/3218 */
                        db_count_control =
-                               S_028004_PERFECT_ZPASS_COUNTS(has_perfect_queries) |
+                               S_028004_PERFECT_ZPASS_COUNTS(1) |
                                S_028004_DISABLE_CONSERVATIVE_ZPASS_COUNTS(gfx10_perfect) |
                                S_028004_SAMPLE_RATE(sample_rate) |
                                S_028004_ZPASS_ENABLE(1) |