Add time function

Updates to objects should not be done in frame by frame basis, but by
time difference. This commit adds time diff function which can be used
to tell how much time has passed since last frame.
This commit is contained in:
Piotr Krygier committed 2023-09-26 14:15:21 +02:00
1 parent 863f502dde
commit 0ef475e57e
3 files changed
+34 -3

No files matched your search

+6 -2
View File
@@ -562,13 +562,13 @@ uint8_t init_vulkan()
STATUS_CHECK(create_descriptors());
STATUS_CHECK(create_sync_objects());
rse_init_time();
return status;
}
void draw_frame()
{
vkWaitForFences(g_vulkan_state.device, 1, &g_in_flight_fences[g_vulkan_state.current_frame], VK_TRUE, UINT64_MAX);
uint32_t image_index = 0U;
VkResult result = VK_FALSE;
VkSubmitInfo submit_info = {};
@@ -578,6 +578,10 @@ void draw_frame()
VkPresentInfoKHR present_info = {};
VkSwapchainKHR swap_chains[1];
vkWaitForFences(g_vulkan_state.device, 1, &g_in_flight_fences[g_vulkan_state.current_frame], VK_TRUE, UINT64_MAX);
rse_update_time();
result = vkAcquireNextImageKHR(g_vulkan_state.device, g_vulkan_state.swapchain, UINT64_MAX, g_image_available_semaphores[g_vulkan_state.current_frame],
VK_NULL_HANDLE, &image_index);