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

Aligned usage of flip between compat and real primary surface chains

Using flip for direct front buffer updates can cause performance problems
if the driver forces vertical sync and overrides the DDFLIP_NOVSYNC flag.

On the other hand, DDFLIP_NOVSYNC flip requests on the compat primary
surface should be handled via real flip to allow vertical sync override.
This commit is contained in:
narzoul 2016-04-03 15:13:38 +02:00
parent be67dff295
commit c78c7c927f

View File

@ -64,6 +64,14 @@ namespace
CompatPaletteConverter::unlockDc();
CompatPaletteConverter::unlockSurface();
if (dest == g_frontBuffer)
{
// Force the screen to be updated. It won't refresh from BitBlt alone.
RECT r = { 0, 0, 1, 1 };
CompatDirectDrawSurface<IDirectDrawSurface7>::s_origVtable.BltFast(
g_frontBuffer, 0, 0, g_frontBuffer, &r, DDBLTFAST_WAIT);
}
}
else
{
@ -99,18 +107,7 @@ namespace
void updateNow()
{
QueryPerformanceCounter(&g_lastUpdateTime);
if (g_backBuffer)
{
if (compatBlt(g_backBuffer))
{
g_frontBuffer->lpVtbl->Flip(g_frontBuffer, nullptr, DDFLIP_NOVSYNC | DDFLIP_WAIT);
}
}
else
{
compatBlt(g_frontBuffer);
}
compatBlt(g_frontBuffer);
}
DWORD WINAPI updateThreadProc(LPVOID /*lpParameter*/)
@ -235,12 +232,6 @@ HRESULT RealPrimarySurface::flip(DWORD flags)
return DDERR_NOTFLIPPABLE;
}
if (flags & DDFLIP_NOVSYNC)
{
update();
return DD_OK;
}
compatBlt(g_backBuffer);
if (flags & DDFLIP_DONOTWAIT)
{