Skip to content

Commit

Permalink
Update VKgraphicsContext.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
beaumanvienna committed Oct 13, 2024
1 parent 0040106 commit 1d3c968
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions engine/platform/Vulkan/VKgraphicsContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Model> VK_Context::LoadModel(const Builder& builder)
Expand Down

0 comments on commit 1d3c968

Please sign in to comment.