From 5937d19750d3fa764355f63862036b3985d6ffbe Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Mon, 1 Dec 2025 13:07:55 -0400 Subject: [PATCH] [vk] Sample Locations ordering --- .../renderer_vulkan/vk_rasterizer.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index c73018e351..d2731632d0 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -53,6 +53,15 @@ using VideoCommon::ImageViewType; namespace { constexpr float SAMPLE_LOCATION_SCALE = 1.0f / 16.0f; +bool SampleLocationsEqual(const std::array& lhs, + const std::array& rhs, + u32 count) { + return std::equal(lhs.begin(), lhs.begin() + count, rhs.begin(), rhs.begin() + count, + [](const VkSampleLocationEXT& a, const VkSampleLocationEXT& b) { + return a.x == b.x && a.y == b.y; + }); +} + std::array DecodeSampleLocationRegisters(const Maxwell& regs) { std::array decoded{}; @@ -1721,13 +1730,13 @@ void RasterizerVulkan::UpdateSampleLocations(Maxwell& regs) { .height = grid_height, }; - const bool pattern_changed = !sample_location_state.initialized || - sample_location_state.msaa_mode != msaa_mode || - sample_location_state.grid_size.width != grid_size.width || - sample_location_state.grid_size.height != grid_size.height || - sample_location_state.samples_per_pixel != vk_samples || - sample_location_state.locations_count != sample_locations_count || - sample_location_state.locations != resolved; + const bool pattern_changed = + !sample_location_state.initialized || sample_location_state.msaa_mode != msaa_mode || + sample_location_state.grid_size.width != grid_size.width || + sample_location_state.grid_size.height != grid_size.height || + sample_location_state.samples_per_pixel != vk_samples || + sample_location_state.locations_count != sample_locations_count || + !SampleLocationsEqual(sample_location_state.locations, resolved, sample_locations_count); const bool dirty = state_tracker.TouchSampleLocations() || pattern_changed; if (!dirty) {