mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Resync source surface from system memory during presentation blit
Fixes issues with writing to unlocked primary surfaces (e.g. Nox).
This commit is contained in:
parent
d23904afd2
commit
7b6b7c911c
@ -204,6 +204,10 @@ namespace D3dDdi
|
||||
prepareForRendering(data.DstSubResourceIndex, false);
|
||||
return it->second.splitBlt(data, data.SrcSubResourceIndex, data.SrcRect, data.DstRect);
|
||||
}
|
||||
else if (m_fixedData.Flags.Primary)
|
||||
{
|
||||
return presentationBlt(data, it->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sysMemPreferredBlt(data, it->second);
|
||||
@ -444,6 +448,25 @@ namespace D3dDdi
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT Resource::presentationBlt(const D3DDDIARG_BLT& data, Resource& srcResource)
|
||||
{
|
||||
if (data.SrcSubResourceIndex < srcResource.m_lockData.size())
|
||||
{
|
||||
if (srcResource.m_lockData[data.SrcSubResourceIndex].isVidMemUpToDate)
|
||||
{
|
||||
if (srcResource.m_lockData[data.SrcSubResourceIndex].isSysMemUpToDate)
|
||||
{
|
||||
copySubResource(srcResource, *srcResource.m_lockResource, data.SrcSubResourceIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
srcResource.copyToVidMem(data.SrcSubResourceIndex);
|
||||
}
|
||||
}
|
||||
return m_device.getOrigVtable().pfnBlt(m_device, &data);
|
||||
}
|
||||
|
||||
void Resource::setLockResource(Resource* lockResource)
|
||||
{
|
||||
if (!m_lockResource == !lockResource)
|
||||
|
@ -82,6 +82,7 @@ namespace D3dDdi
|
||||
void moveToSysMem(UINT subResourceIndex);
|
||||
void moveToVidMem(UINT subResourceIndex);
|
||||
void prepareSubResourceForRendering(UINT subResourceIndex, bool isReadOnly);
|
||||
HRESULT presentationBlt(const D3DDDIARG_BLT& data, Resource& srcResource);
|
||||
void setSysMemUpToDate(UINT subResourceIndex, bool upToDate);
|
||||
void setVidMemUpToDate(UINT subResourceIndex, bool upToDate);
|
||||
HRESULT splitBlt(D3DDDIARG_BLT& data, UINT& subResourceIndex, RECT& rect, RECT& otherRect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user