Support lazy CGraphics::CommitResources

This commit is contained in:
Henrique Gemignani Passos Lima 2021-06-29 23:09:30 +03:00
parent 0b523f98c3
commit d2ae2b3818
4 changed files with 31 additions and 2 deletions

View File

@ -397,6 +397,7 @@ public:
m_window->waitForRetrace();
}
OPTICK_FRAME("MainThread");
CGraphics::SetCommitResourcesAsLazy(true);
boo::SWindowRect rect = m_windowCallback.m_lastRect;
rect.location = {0, 0};
@ -465,6 +466,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,9 +346,31 @@ public:
static const boo::SystemChar* 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) {
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) {
g_BooMainCommandQueue->setShaderDataBinding(binding);

2
extern/boo vendored

@ -1 +1 @@
Subproject commit 542191fd70e8835576f2d1320859291518972e8a
Subproject commit c6aed360e6bb0537afc4f597104810f76e1340fc