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

Fixed slowdowns caused by palette animation support

The vsynced paletted update is causing performance problems in games that
frequently update the palette outside of a palette animation loop, e.g. StarCraft.

Vsync has been removed from the palette update, and instead a primary surface
synchronization is forced on the main thread, which still seems to preserve
the palette fade-in/fade-out effects in Fallout. Perhaps only the small delay
introduced by the sync was needed? (Seems it would work with Sleep(1) too).
This commit is contained in:
narzoul 2016-01-10 21:00:21 +01:00
parent 1999d1c56e
commit 1883d919da
2 changed files with 2 additions and 22 deletions

View File

@ -6,5 +6,4 @@ namespace Config
{
const DWORD minRefreshInterval = 1000 / 60;
const DWORD minRefreshIntervalAfterFlip = 1000 / 10;
const DWORD minPaletteUpdateInterval = 1000 / 60;
}

View File

@ -361,10 +361,7 @@ void RealPrimarySurface::setPalette(LPDIRECTDRAWPALETTE palette)
}
}
if (palette)
{
updatePalette();
}
updatePalette();
}
void RealPrimarySurface::update()
@ -376,21 +373,5 @@ void RealPrimarySurface::update()
void RealPrimarySurface::updatePalette()
{
CompatGdi::updatePalette();
if (isFullScreen())
{
flip(DDFLIP_WAIT);
}
else
{
update();
}
static LARGE_INTEGER lastUpdateTime = {};
DWORD timeSinceLastUpdate = getTimeElapsedInMs(lastUpdateTime);
if (timeSinceLastUpdate < Config::minPaletteUpdateInterval)
{
Sleep(Config::minPaletteUpdateInterval - timeSinceLastUpdate);
}
QueryPerformanceCounter(&lastUpdateTime);
updateNow();
}