diff --git a/cube/cube.c b/cube/cube.c index b4db7500c..abc3dfb9e 100644 --- a/cube/cube.c +++ b/cube/cube.c @@ -1300,8 +1300,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. // @@ -1324,15 +1325,14 @@ 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; - } + + present.pNext = &present_time; } err = vkQueuePresentKHR(demo->present_queue, &present);