From 04fc3c808b1394094e55db22e3eebfbac3e6eeb4 Mon Sep 17 00:00:00 2001 From: narzoul Date: Thu, 26 May 2016 00:56:24 +0200 Subject: [PATCH] Added triple buffering in full screen mode Fixes stuttering in Midtown Madness 2 Trial (and probably other games) when V-sync is enabled. --- DDrawCompat/RealPrimarySurface.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/DDrawCompat/RealPrimarySurface.cpp b/DDrawCompat/RealPrimarySurface.cpp index 74f3809..9a2b7a6 100644 --- a/DDrawCompat/RealPrimarySurface.cpp +++ b/DDrawCompat/RealPrimarySurface.cpp @@ -212,7 +212,7 @@ HRESULT RealPrimarySurface::create(CompatRef dd) desc.dwSize = sizeof(desc); desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP; - desc.dwBackBufferCount = 1; + desc.dwBackBufferCount = 2; CompatPtr::TCreatedSurface> surface; HRESULT result = dd->CreateSurface(&dd, &desc, &surface.getRef(), nullptr); @@ -266,12 +266,8 @@ HRESULT RealPrimarySurface::flip(DWORD flags) invalidate(nullptr); compatBlt(*g_backBuffer); - if (flags & DDFLIP_DONOTWAIT) - { - flags ^= DDFLIP_DONOTWAIT; - } - HRESULT result = g_frontBuffer->Flip(g_frontBuffer, nullptr, flags | DDFLIP_WAIT); + HRESULT result = g_frontBuffer->Flip(g_frontBuffer, nullptr, flags); if (SUCCEEDED(result)) { g_qpcNextUpdate = getNextUpdateQpc(