From 0a312787cdb1a2e97ff2c112f894ebda6591c961 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: (cherry picked from commit a160c2a14e71bb36d420929b0cb408f6346d845d) --- .pick_status.json | 2 +- src/nouveau/vulkan/nvk_cmd_draw.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index b4cef18018e..fed9a62e22c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -494,7 +494,7 @@ "description": "nvk: Re-emit sample locations when rasterization samples changes", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "41d094c2cc1da09444830dca866d2be7f03ae5b4", "notes": null diff --git a/src/nouveau/vulkan/nvk_cmd_draw.c b/src/nouveau/vulkan/nvk_cmd_draw.c index f0380b46790..d8e4e625f7e 100644 --- a/src/nouveau/vulkan/nvk_cmd_draw.c +++ b/src/nouveau/vulkan/nvk_cmd_draw.c @@ -1438,13 +1438,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++) {