From 2ad2a5cfa9a4a307fdbc58dd6f99857c239b7b42 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Wed, 30 Jun 2021 20:27:36 +0300 Subject: [PATCH] Add cvar for when commit resources is done lazily --- Runtime/CMain.cpp | 2 +- hecl/include/hecl/CVarCommons.hpp | 1 + hecl/lib/CVarCommons.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Runtime/CMain.cpp b/Runtime/CMain.cpp index d39f0e5da..f5c4a25d3 100644 --- a/Runtime/CMain.cpp +++ b/Runtime/CMain.cpp @@ -397,7 +397,7 @@ public: m_window->waitForRetrace(); } OPTICK_FRAME("MainThread"); - CGraphics::SetCommitResourcesAsLazy(true); + CGraphics::SetCommitResourcesAsLazy(m_cvarCommons.m_lazyCommitResources->toBoolean()); boo::SWindowRect rect = m_windowCallback.m_lastRect; rect.location = {0, 0}; diff --git a/hecl/include/hecl/CVarCommons.hpp b/hecl/include/hecl/CVarCommons.hpp index 354c960ce..5dc39170c 100644 --- a/hecl/include/hecl/CVarCommons.hpp +++ b/hecl/include/hecl/CVarCommons.hpp @@ -27,6 +27,7 @@ struct CVarCommons { CVar* m_texAnisotropy = nullptr; CVar* m_deepColor = nullptr; CVar* m_variableDt = nullptr; + CVar* m_lazyCommitResources = nullptr; CVar* m_debugOverlayPlayerInfo = nullptr; CVar* m_debugOverlayWorldInfo = nullptr; diff --git a/hecl/lib/CVarCommons.cpp b/hecl/lib/CVarCommons.cpp index a34d11e16..8d1c1d367 100644 --- a/hecl/lib/CVarCommons.cpp +++ b/hecl/lib/CVarCommons.cpp @@ -24,6 +24,9 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) { m_variableDt = m_mgr.findOrMakeCVar( "variableDt", "Enable variable delta time (experimental)", false, (hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::ModifyRestart)); + m_lazyCommitResources = m_mgr.findOrMakeCVar( + "lazyCommitResources"sv, "Enable lazy commiting resources to GPU", true, + (hecl::CVar::EFlags::System | hecl::CVar::EFlags::Archive)); m_debugOverlayPlayerInfo = m_mgr.findOrMakeCVar( "debugOverlay.playerInfo"sv, "Displays information about the player, such as location and orientation"sv, false,