aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmma Anholt <emma@anholt.net>2025-11-13 14:19:14 -0800
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2025-11-14 16:20:39 -0700
commit99491e2c512d4ed526aaf9c7e34ccfd3d22e98fe (patch)
tree81e90f7e97ac172d37acc63a6e57952a7a370928
parent17e6fb5043bd0435edef55330bcd026047caf62a (diff)
downloadusermoji-99491e2c512d4ed526aaf9c7e34ccfd3d22e98fe.tar.xz
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.
-rw-r--r--cube/cube.c6
1 files 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 = &regions;
}
+ 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;
}