From 1d3c9689958f70a9bf0e31d8fbbe13649bbb2ff5 Mon Sep 17 00:00:00 2001 From: JC Date: Sun, 13 Oct 2024 13:44:37 -0700 Subject: [PATCH] Update VKgraphicsContext.cpp --- engine/platform/Vulkan/VKgraphicsContext.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/engine/platform/Vulkan/VKgraphicsContext.cpp b/engine/platform/Vulkan/VKgraphicsContext.cpp index 9dffa39d..3fea60f4 100644 --- a/engine/platform/Vulkan/VKgraphicsContext.cpp +++ b/engine/platform/Vulkan/VKgraphicsContext.cpp @@ -58,21 +58,20 @@ namespace GfxRenderEngine void VK_Context::LimitFrameRate(Chrono::TimePoint startTime) { ZoneScopedN("LimitFrameRate"); -#ifndef MACOSX auto diffTime = Engine::m_Engine->GetTime() - startTime; auto sleepTime = m_MinFrameDuration - diffTime; if (sleepTime > 0s) { +#ifdef MACOSX + static constexpr Chrono::Duration MACOS_MAX_SLEEP_TIME = 10ms; + if (sleepTime > MACOS_MAX_SLEEP_TIME) + { + sleepTime = MACOS_MAX_SLEEP_TIME; + } +#endif std::this_thread::sleep_for(sleepTime); } -#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)