From 99491e2c512d4ed526aaf9c7e34ccfd3d22e98fe Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Thu, 13 Nov 2025 14:19:14 -0800 Subject: cube: Fix VK_GOOGLE_display_timing path. We were referencing present_time and ptime past their lifetimes in the block, resulting in corruption of the pNext chain. --- cube/cube.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cube/cube.c b/cube/cube.c index 5797ca51..e21f3a28 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -1301,8 +1301,9 @@ static void demo_draw(struct demo *demo) { present.pNext = ®ions; } + VkPresentTimesInfoGOOGLE present_time; + VkPresentTimeGOOGLE ptime; if (demo->VK_GOOGLE_display_timing_enabled) { - VkPresentTimeGOOGLE ptime; if (demo->prev_desired_present_time == 0) { // This must be the first present for this swapchain. // @@ -1325,12 +1326,13 @@ static void demo_draw(struct demo *demo) { ptime.presentID = demo->next_present_id++; demo->prev_desired_present_time = ptime.desiredPresentTime; - VkPresentTimesInfoGOOGLE present_time = { + present_time = (VkPresentTimesInfoGOOGLE){ .sType = VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE, .pNext = present.pNext, .swapchainCount = present.swapchainCount, .pTimes = &ptime, }; + if (demo->VK_GOOGLE_display_timing_enabled) { present.pNext = &present_time; } -- cgit v1.2.3