From a160c2a14e71bb36d420929b0cb408f6346d845d Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 10 May 2024 16:32:05 -0500 Subject: [PATCH] nvk: Re-emit sample locations when rasterization samples changes We need them for the case where explicit sample locations are not enabled. While we're at it, fix the case where rasterization_samples=0. This can happen when rasterizer discard is enabled. This fixes MSAA resolves with NVK+Zink. In particular, it fixes MSAA for the Unigine Heaven and Valley benchmark. This also fixes all of the spec@arb_texture_float@multisample-formats piglit tests. Fixes: 41d094c2cc1d ("nvk: Support dynamic state for enabling sample locations") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10786 Part-of: --- src/nouveau/vulkan/nvk_cmd_draw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c b/src/nouveau/vulkan/nvk_cmd_draw.c index 5d74108349e..b245fe579ba 100644 --- a/src/nouveau/vulkan/nvk_cmd_draw.c +++ b/src/nouveau/vulkan/nvk_cmd_draw.c @@ -1724,13 +1724,15 @@ nvk_flush_ms_state(struct nvk_cmd_buffer *cmd) }); } - if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS) || + if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_RASTERIZATION_SAMPLES) || + BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_MS_SAMPLE_LOCATIONS_ENABLE)) { const struct vk_sample_locations_state *sl; if (dyn->ms.sample_locations_enable) { sl = dyn->ms.sample_locations; } else { - sl = vk_standard_sample_locations_state(dyn->ms.rasterization_samples); + const uint32_t samples = MAX2(1, dyn->ms.rasterization_samples); + sl = vk_standard_sample_locations_state(samples); } for (uint32_t i = 0; i < sl->per_pixel; i++) {