From d3a4a221f5ad18bde713eaa9bba116ad7ab2be2b Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 15 Sep 2020 17:29:09 -0400 Subject: [PATCH] Limit refresh rate to 60hz when not using variableDt Fixes #334 --- Editor/main.cpp | 11 ++++++++--- hecl | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Editor/main.cpp b/Editor/main.cpp index 36220f921..02761ba96 100644 --- a/Editor/main.cpp +++ b/Editor/main.cpp @@ -99,8 +99,6 @@ struct Application : boo::IApplicationCallback { } } - m_cvarManager.parseCommandLine(app->getArgs()); - const zeus::CPUInfo& cpuInf = zeus::cpuFeatures(); Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand); Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor); @@ -114,6 +112,8 @@ struct Application : boo::IApplicationCallback { uint32_t getAnisotropy() const { return m_cvarCommons.getAnisotropy(); } bool getDeepColor() const { return m_cvarCommons.getDeepColor(); } + + int64_t getTargetFrameTime() { return m_cvarCommons.getVariableFrameTime() ? 0 : 1000000000L / 60; } }; } // namespace urde @@ -165,6 +165,11 @@ int main(int argc, const boo::SystemChar** argv) hecl::CVarManager cvarMgr{fileMgr}; hecl::CVarCommons cvarCmns{cvarMgr}; + std::vector args; + for (int i = 1; i < argc; ++i) + args.push_back(argv[i]); + cvarMgr.parseCommandLine(args); + hecl::SystemStringView logFile = hecl::SystemStringConv(cvarCmns.getLogFile()).sys_str(); hecl::SystemString logFilePath; if (!logFile.empty()) { @@ -191,7 +196,7 @@ int main(int argc, const boo::SystemChar** argv) urde::Application appCb(fileMgr, cvarMgr, cvarCmns); int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto, appCb, _SYS_STR("urde"), _SYS_STR("URDE"), argc, argv, appCb.getGraphicsApi(), appCb.getSamples(), appCb.getAnisotropy(), - appCb.getDeepColor(), false); + appCb.getDeepColor(), appCb.getTargetFrameTime(), false); // printf("IM DYING!!\n"); return ret; } diff --git a/hecl b/hecl index d0192a162..1dd9c3477 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit d0192a1623f0114fc93de10737a6c1d5f89c4e22 +Subproject commit 1dd9c3477244f2e68ecdb9330179a34d867038d3