1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Don't count overlay-only updates in present stats

This commit is contained in:
narzoul 2023-07-15 14:43:10 +02:00
parent f13e010834
commit ca485fc15c

View File

@ -339,18 +339,21 @@ namespace
g_flipEndVsyncCount = g_presentEndVsyncCount; g_flipEndVsyncCount = g_presentEndVsyncCount;
} }
void presentToPrimaryChain(CompatWeakPtr<IDirectDrawSurface7> src) void presentToPrimaryChain(CompatWeakPtr<IDirectDrawSurface7> src, bool isOverlayOnly)
{ {
LOG_FUNC("RealPrimarySurface::presentToPrimaryChain", src); LOG_FUNC("RealPrimarySurface::presentToPrimaryChain", src, isOverlayOnly);
Gdi::VirtualScreen::update(); Gdi::VirtualScreen::update();
Gdi::GuiThread::execute([]() Gdi::GuiThread::execute([&]()
{ {
auto statsWindow = Gdi::GuiThread::getStatsWindow(); auto statsWindow = Gdi::GuiThread::getStatsWindow();
if (statsWindow) if (statsWindow)
{ {
statsWindow->m_present.add(); if (!isOverlayOnly)
{
statsWindow->m_present.add();
}
statsWindow->update(); statsWindow->update();
} }
@ -380,7 +383,7 @@ namespace
bltToPrimaryChain(*src); bltToPrimaryChain(*src);
} }
void updateNow(CompatWeakPtr<IDirectDrawSurface7> src) void updateNow(CompatWeakPtr<IDirectDrawSurface7> src, bool isOverlayOnly)
{ {
{ {
Compat::ScopedCriticalSection lock(g_presentCs); Compat::ScopedCriticalSection lock(g_presentCs);
@ -389,7 +392,7 @@ namespace
g_isUpdateReady = false; g_isUpdateReady = false;
} }
presentToPrimaryChain(src); presentToPrimaryChain(src, isOverlayOnly);
if (g_isFullscreen) if (g_isFullscreen)
{ {
@ -610,6 +613,8 @@ namespace DDraw
updatePresentationWindow(); updatePresentationWindow();
} }
bool isOverlayOnly = false;
{ {
Compat::ScopedCriticalSection lock(g_presentCs); Compat::ScopedCriticalSection lock(g_presentCs);
if (!g_isUpdateReady) if (!g_isUpdateReady)
@ -637,6 +642,7 @@ namespace DDraw
{ {
g_qpcLastUpdate = Time::queryPerformanceCounter(); g_qpcLastUpdate = Time::queryPerformanceCounter();
g_isUpdateReady = true; g_isUpdateReady = true;
isOverlayOnly = true;
} }
} }
@ -674,7 +680,7 @@ namespace DDraw
return 1; return 1;
} }
updateNow(src); updateNow(src, isOverlayOnly);
return 0; return 0;
} }