Skip to content

Commit 99491e2

Browse files
anholtcharles-lunarg
authored andcommitted
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.
1 parent 17e6fb5 commit 99491e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cube/cube.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,9 @@ static void demo_draw(struct demo *demo) {
13011301
present.pNext = &regions;
13021302
}
13031303

1304+
VkPresentTimesInfoGOOGLE present_time;
1305+
VkPresentTimeGOOGLE ptime;
13041306
if (demo->VK_GOOGLE_display_timing_enabled) {
1305-
VkPresentTimeGOOGLE ptime;
13061307
if (demo->prev_desired_present_time == 0) {
13071308
// This must be the first present for this swapchain.
13081309
//
@@ -1325,12 +1326,13 @@ static void demo_draw(struct demo *demo) {
13251326
ptime.presentID = demo->next_present_id++;
13261327
demo->prev_desired_present_time = ptime.desiredPresentTime;
13271328

1328-
VkPresentTimesInfoGOOGLE present_time = {
1329+
present_time = (VkPresentTimesInfoGOOGLE){
13291330
.sType = VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE,
13301331
.pNext = present.pNext,
13311332
.swapchainCount = present.swapchainCount,
13321333
.pTimes = &ptime,
13331334
};
1335+
13341336
if (demo->VK_GOOGLE_display_timing_enabled) {
13351337
present.pNext = &present_time;
13361338
}

0 commit comments

Comments
 (0)