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

Fixed a performance issue with windowed fullscreen GDI presentation

See issue #273.
This commit is contained in:
narzoul 2024-06-26 20:10:32 +02:00
parent ddc45d7f36
commit 7237acb11c
3 changed files with 9 additions and 2 deletions

View File

@ -598,7 +598,7 @@ namespace D3dDdi
flags.ZBuffer = 0;
}
if (D3DDDIPOOL_SYSTEMMEM == m_fixedData.Pool ||
m_isSurfaceRepoResource ||
m_isSurfaceRepoResource && !SurfaceRepository::isLockResourceEnabled() ||
0 == m_formatInfo.bytesPerPixel ||
0 != (m_fixedData.Flags.Value & flags.Value) ||
m_fixedData.Flags.Texture && (DDraw::Surface::getCurrentSurfaceCaps().dwCaps2 & 0x100000)) // managed texture
@ -1304,6 +1304,7 @@ namespace D3dDdi
srcResource = &srcResource->prepareForGpuRead(data.SrcSubResourceIndex);
}
prepareForGpuWrite(data.DstSubResourceIndex);
LONG srcWidth = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Width;
LONG srcHeight = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Height;

View File

@ -354,8 +354,11 @@ namespace D3dDdi
CompatPtr<IDirectDrawSurface7> SurfaceRepository::getWindowedBackBuffer(DWORD width, DWORD height)
{
return getSurface(m_windowedBackBuffer, width, height, D3DDDIFMT_X8R8G8B8,
s_isLockResourceEnabled = true;
auto surface = getSurface(m_windowedBackBuffer, width, height, D3DDDIFMT_X8R8G8B8,
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY).surface;
s_isLockResourceEnabled = false;
return surface;
}
CompatWeakPtr<IDirectDrawSurface7> SurfaceRepository::getWindowedPrimary()
@ -441,4 +444,5 @@ namespace D3dDdi
}
bool SurfaceRepository::s_inCreateSurface = false;
bool SurfaceRepository::s_isLockResourceEnabled = false;
}

View File

@ -62,6 +62,7 @@ namespace D3dDdi
static SurfaceRepository& get(const Adapter& adapter);
static SurfaceRepository& getPrimaryRepo();
static bool inCreateSurface() { return s_inCreateSurface; }
static bool isLockResourceEnabled() { return s_isLockResourceEnabled; }
static void enableSurfaceCheck(bool enable);
private:
@ -93,5 +94,6 @@ namespace D3dDdi
CompatPtr<IDirectDrawSurface7> m_windowedPrimary;
static bool s_inCreateSurface;
static bool s_isLockResourceEnabled;
};
}