From 38ba29bed8622d66ee34ace7903b43cbac08ff76 Mon Sep 17 00:00:00 2001 From: JC Date: Fri, 11 Oct 2024 22:47:16 -0700 Subject: [PATCH] Update VKgraphicsContext.cpp --- engine/platform/Vulkan/VKgraphicsContext.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/platform/Vulkan/VKgraphicsContext.cpp b/engine/platform/Vulkan/VKgraphicsContext.cpp index a6da4c25..eadc40d6 100644 --- a/engine/platform/Vulkan/VKgraphicsContext.cpp +++ b/engine/platform/Vulkan/VKgraphicsContext.cpp @@ -57,6 +57,8 @@ namespace GfxRenderEngine void VK_Context::SwapBuffers() { + ZoneScopedN("SwapBuffers"); +#ifndef MACOSX auto diffTime = Engine::m_Engine->GetTime() - m_StartTime; auto sleepTime = m_FrameDuration - diffTime - 150us; if (sleepTime < 0s) @@ -77,6 +79,13 @@ namespace GfxRenderEngine } // here starts the new frame m_StartTime = Engine::m_Engine->GetTime(); +#else + std::this_thread::sleep_for(10ms); + auto oldStartTime = m_StartTime; + m_StartTime = std::chrono::high_resolution_clock::now(); + auto frameDuration = m_StartTime - oldStartTime; + std::cout << "frameDuration: " << frameDuration.count() / 1000000.0f << " ms" << std::endl; +#endif } std::shared_ptr VK_Context::LoadModel(const Builder& builder)