mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
ImguiSystem: perform atomic exchange before acquiring snapshot lock
Significantly improves performance when none of the imgui surfaces are being drawn.
This commit is contained in:
parent
4d2ac77ac7
commit
e2b931d6d8
@ -155,13 +155,12 @@ void CImguiSystem::SwapBuffers()
|
||||
void CImguiSystem::RenderFrame()
|
||||
{
|
||||
Assert(IsInitialized());
|
||||
AUTO_LOCK(m_snapshotBufferMutex);
|
||||
|
||||
if (!m_hasNewFrame)
|
||||
if (!m_hasNewFrame.exchange(false))
|
||||
return;
|
||||
|
||||
AUTO_LOCK(m_snapshotBufferMutex);
|
||||
ImGui_ImplDX11_RenderDrawData(&m_snapshotData.DrawData);
|
||||
m_hasNewFrame = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -46,7 +46,7 @@ private:
|
||||
mutable CThreadMutex m_inputEventQueueMutex;
|
||||
|
||||
bool m_initialized;
|
||||
bool m_hasNewFrame;
|
||||
std::atomic_bool m_hasNewFrame;
|
||||
};
|
||||
|
||||
CImguiSystem* ImguiSystem();
|
||||
|
Loading…
x
Reference in New Issue
Block a user