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:
parent
ddc45d7f36
commit
7237acb11c
@ -598,7 +598,7 @@ namespace D3dDdi
|
|||||||
flags.ZBuffer = 0;
|
flags.ZBuffer = 0;
|
||||||
}
|
}
|
||||||
if (D3DDDIPOOL_SYSTEMMEM == m_fixedData.Pool ||
|
if (D3DDDIPOOL_SYSTEMMEM == m_fixedData.Pool ||
|
||||||
m_isSurfaceRepoResource ||
|
m_isSurfaceRepoResource && !SurfaceRepository::isLockResourceEnabled() ||
|
||||||
0 == m_formatInfo.bytesPerPixel ||
|
0 == m_formatInfo.bytesPerPixel ||
|
||||||
0 != (m_fixedData.Flags.Value & flags.Value) ||
|
0 != (m_fixedData.Flags.Value & flags.Value) ||
|
||||||
m_fixedData.Flags.Texture && (DDraw::Surface::getCurrentSurfaceCaps().dwCaps2 & 0x100000)) // managed texture
|
m_fixedData.Flags.Texture && (DDraw::Surface::getCurrentSurfaceCaps().dwCaps2 & 0x100000)) // managed texture
|
||||||
@ -1304,6 +1304,7 @@ namespace D3dDdi
|
|||||||
|
|
||||||
srcResource = &srcResource->prepareForGpuRead(data.SrcSubResourceIndex);
|
srcResource = &srcResource->prepareForGpuRead(data.SrcSubResourceIndex);
|
||||||
}
|
}
|
||||||
|
prepareForGpuWrite(data.DstSubResourceIndex);
|
||||||
|
|
||||||
LONG srcWidth = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Width;
|
LONG srcWidth = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Width;
|
||||||
LONG srcHeight = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Height;
|
LONG srcHeight = srcResource->m_fixedData.pSurfList[data.SrcSubResourceIndex].Height;
|
||||||
|
@ -354,8 +354,11 @@ namespace D3dDdi
|
|||||||
|
|
||||||
CompatPtr<IDirectDrawSurface7> SurfaceRepository::getWindowedBackBuffer(DWORD width, DWORD height)
|
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;
|
DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY).surface;
|
||||||
|
s_isLockResourceEnabled = false;
|
||||||
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
CompatWeakPtr<IDirectDrawSurface7> SurfaceRepository::getWindowedPrimary()
|
CompatWeakPtr<IDirectDrawSurface7> SurfaceRepository::getWindowedPrimary()
|
||||||
@ -441,4 +444,5 @@ namespace D3dDdi
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SurfaceRepository::s_inCreateSurface = false;
|
bool SurfaceRepository::s_inCreateSurface = false;
|
||||||
|
bool SurfaceRepository::s_isLockResourceEnabled = false;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ namespace D3dDdi
|
|||||||
static SurfaceRepository& get(const Adapter& adapter);
|
static SurfaceRepository& get(const Adapter& adapter);
|
||||||
static SurfaceRepository& getPrimaryRepo();
|
static SurfaceRepository& getPrimaryRepo();
|
||||||
static bool inCreateSurface() { return s_inCreateSurface; }
|
static bool inCreateSurface() { return s_inCreateSurface; }
|
||||||
|
static bool isLockResourceEnabled() { return s_isLockResourceEnabled; }
|
||||||
static void enableSurfaceCheck(bool enable);
|
static void enableSurfaceCheck(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -93,5 +94,6 @@ namespace D3dDdi
|
|||||||
CompatPtr<IDirectDrawSurface7> m_windowedPrimary;
|
CompatPtr<IDirectDrawSurface7> m_windowedPrimary;
|
||||||
|
|
||||||
static bool s_inCreateSurface;
|
static bool s_inCreateSurface;
|
||||||
|
static bool s_isLockResourceEnabled;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user