From 0b560952822cfba31da32ba42288589a30225074 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 25 Aug 2023 12:47:29 +0200 Subject: [PATCH] vk/graphics_state: Fix copying MS locations pipeline state Copying the state below overwrote the ms.sample_locations we set, so our new_sample_locations was never actually used and we were accidentally doing a shallow copy. Turnip passes a stack-allocated old_state, so this resulted in invalid stack pointers. Fixes: f497cc9d56e ("vk/graphics_state: Add helpers for pre-baking state") Part-of: (cherry picked from commit 1cef1f02b543c75da96359edb09640537212c4df) --- .pick_status.json | 2 +- src/vulkan/runtime/vk_graphics_state.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 612f3548a64..698beb0af01 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -7594,7 +7594,7 @@ "description": "vk/graphics_state: Fix copying MS locations pipeline state", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f497cc9d56e173c62a87b81b02a284e20eff9345", "notes": null diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 0a7b07288f5..cf325ce129a 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -1668,10 +1668,6 @@ vk_graphics_pipeline_state_copy(const struct vk_device *device, *new_sample_locations = *old_state->ms->sample_locations; } - if (new_ms) { - new_ms->sample_locations = new_sample_locations; - } - #define COPY_STATE_IF_NEEDED(STATE, type, s) \ if (new_##s) { \ *new_##s = *old_state->s; \ @@ -1680,6 +1676,10 @@ vk_graphics_pipeline_state_copy(const struct vk_device *device, FOREACH_STATE_GROUP(COPY_STATE_IF_NEEDED) + if (new_ms) { + new_ms->sample_locations = new_sample_locations; + } + state->shader_stages = old_state->shader_stages; BITSET_COPY(state->dynamic, old_state->dynamic);