radv: do not enable VRS flat shading if the VRS builtin is read
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 23 May 2023 16:50:52 +0000 (18:50 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 24 May 2023 09:02:31 +0000 (09:02 +0000)
When the fragment shader reads the VRS builtin, VRS flat shading
shouldn't be enabled, otherwise the value might not be what the FS
expects.

Fixes dEQP-VK.fragment_shading_rate.renderpass2.monolithic.multipass.*
on RDNA2 (VRS flat shading isn't yet enabled on RDNA3).

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23187>

src/amd/vulkan/radv_shader_info.c

index 508b92f..2deb449 100644 (file)
@@ -587,7 +587,8 @@ gather_shader_info_fs(const struct radv_device *device, const nir_shader *nir,
 
    info->ps.allow_flat_shading =
       !(uses_persp_or_linear_interp || info->ps.needs_sample_positions ||
-        info->ps.writes_memory || nir->info.fs.needs_quad_helper_invocations ||
+        info->ps.reads_frag_shading_rate || info->ps.writes_memory ||
+        nir->info.fs.needs_quad_helper_invocations ||
         BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_FRAG_COORD) ||
         BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_POINT_COORD) ||
         BITSET_TEST(nir->info.system_values_read, SYSTEM_VALUE_SAMPLE_ID) ||