Merge remote-tracking branch 'darkszero/feature/lazy-commit-resources'

# Conflicts:
#	extern/boo
This commit is contained in:
Luke Street 2021-10-25 23:07:56 -04:00
commit a2cc6cd204
6 changed files with 35 additions and 2 deletions

View File

@ -415,6 +415,7 @@ public:
}
OPTICK_FRAME("MainThread");
CGraphics::SetCommitResourcesAsLazy(m_cvarCommons.m_lazyCommitResources->toBoolean());
boo::SWindowRect rect = m_windowCallback.m_lastRect;
rect.location = {0, 0};
@ -482,6 +483,11 @@ public:
m_imGuiConsole.ShowAboutWindow(false, m_errorString);
}
{
OPTICK_EVENT("Flush");
CGraphics::SetCommitResourcesAsLazy(false);
}
{
OPTICK_EVENT("Draw");
gfxQ->setRenderTarget(m_renderTex);

View File

@ -37,6 +37,7 @@ u32 CGraphics::g_FrameCounter = 0;
u32 CGraphics::g_Framerate = 0;
u32 CGraphics::g_FramesPast = 0;
frame_clock::time_point CGraphics::g_FrameStartTime = frame_clock::now();
bool CGraphics::g_commitAsLazy = false;
const std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
/* Right */

View File

@ -346,8 +346,30 @@ public:
static const char* PlatformName() { return g_BooPlatformName; }
static bool g_commitAsLazy;
static void SetCommitResourcesAsLazy(bool newStatus) {
if (newStatus != g_commitAsLazy) {
g_commitAsLazy = newStatus;
if (!newStatus && g_BooFactory) {
g_BooFactory->commitPendingTransaction();
}
}
}
static void CommitResources(const boo::FactoryCommitFunc& commitFunc __BooTraceArgs) {
g_BooFactory->commitTransaction(commitFunc __BooTraceArgsUse);
CommitResources(commitFunc __BooTraceArgsUse, g_commitAsLazy);
}
static void CommitResources(const boo::FactoryCommitFunc& commitFunc __BooTraceArgs, bool lazy) {
if (!g_BooFactory) {
return;
}
if (lazy) {
g_BooFactory->lazyCommitTransaction(commitFunc __BooTraceArgsUse);
} else {
g_BooFactory->commitTransaction(commitFunc __BooTraceArgsUse);
}
}
static void SetShaderDataBinding(const boo::ObjToken<boo::IShaderDataBinding>& binding) {

2
extern/boo vendored

@ -1 +1 @@
Subproject commit 07ded238b484d08769b8e9682d22a3711d971b81
Subproject commit 49cfab476fa53aeedd783b28b644c90a9218f8ff

View File

@ -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;

View File

@ -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,