mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Apply ResolutionScale to the primary surface chain if needed
Fixes inconsistent resolution scaling in The Sims.
This commit is contained in:
parent
537f79f453
commit
70c2b78fa7
@ -135,6 +135,7 @@ namespace D3dDdi
|
|||||||
, m_isSurfaceRepoResource(SurfaceRepository::inCreateSurface() || !g_enableConfig)
|
, m_isSurfaceRepoResource(SurfaceRepository::inCreateSurface() || !g_enableConfig)
|
||||||
, m_isClampable(true)
|
, m_isClampable(true)
|
||||||
, m_isPrimary(false)
|
, m_isPrimary(false)
|
||||||
|
, m_isPrimaryScalingNeeded(false)
|
||||||
, m_isPalettizedTextureUpToDate(false)
|
, m_isPalettizedTextureUpToDate(false)
|
||||||
, m_isColorKeyedSurfaceUpToDate(false)
|
, m_isColorKeyedSurfaceUpToDate(false)
|
||||||
{
|
{
|
||||||
@ -380,6 +381,12 @@ namespace D3dDdi
|
|||||||
srcResource.loadFromLockRefResource(data.SrcSubResourceIndex);
|
srcResource.loadFromLockRefResource(data.SrcSubResourceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_isPrimary && !m_isPrimaryScalingNeeded && srcResource.isScaled(data.SrcSubResourceIndex))
|
||||||
|
{
|
||||||
|
m_isPrimaryScalingNeeded = true;
|
||||||
|
updateConfig();
|
||||||
|
}
|
||||||
|
|
||||||
Resource* srcRes = &srcResource;
|
Resource* srcRes = &srcResource;
|
||||||
if (m_msaaResolvedSurface.resource && srcResource.m_msaaResolvedSurface.resource &&
|
if (m_msaaResolvedSurface.resource && srcResource.m_msaaResolvedSurface.resource &&
|
||||||
(srcResource.m_lockData[data.SrcSubResourceIndex].isMsaaResolvedUpToDate ||
|
(srcResource.m_lockData[data.SrcSubResourceIndex].isMsaaResolvedUpToDate ||
|
||||||
@ -821,13 +828,25 @@ namespace D3dDdi
|
|||||||
SIZE Resource::getScaledSize()
|
SIZE Resource::getScaledSize()
|
||||||
{
|
{
|
||||||
SIZE size = { static_cast<LONG>(m_fixedData.pSurfList[0].Width), static_cast<LONG>(m_fixedData.pSurfList[0].Height) };
|
SIZE size = { static_cast<LONG>(m_fixedData.pSurfList[0].Width), static_cast<LONG>(m_fixedData.pSurfList[0].Height) };
|
||||||
if (m_origData.Flags.RenderTarget || m_fixedData.Flags.ZBuffer)
|
if (m_isPrimary && m_isPrimaryScalingNeeded || m_origData.Flags.RenderTarget || m_fixedData.Flags.ZBuffer)
|
||||||
{
|
{
|
||||||
return m_device.getAdapter().getScaledSize(size);
|
return m_device.getAdapter().getScaledSize(size);
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Resource::isScaled(UINT subResourceIndex)
|
||||||
|
{
|
||||||
|
if (!m_msaaResolvedSurface.resource)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& si = m_fixedData.pSurfList[subResourceIndex];
|
||||||
|
auto& scaledSi = m_msaaResolvedSurface.resource->getFixedDesc().pSurfList[subResourceIndex];
|
||||||
|
return si.Width != scaledSi.Width || si.Height != scaledSi.Height;
|
||||||
|
}
|
||||||
|
|
||||||
bool Resource::isValidRect(UINT subResourceIndex, const RECT& rect)
|
bool Resource::isValidRect(UINT subResourceIndex, const RECT& rect)
|
||||||
{
|
{
|
||||||
return rect.left >= 0 && rect.top >= 0 && rect.left < rect.right && rect.top < rect.bottom &&
|
return rect.left >= 0 && rect.top >= 0 && rect.left < rect.right && rect.top < rect.bottom &&
|
||||||
|
@ -117,6 +117,7 @@ namespace D3dDdi
|
|||||||
D3DDDIFORMAT getFormatConfig();
|
D3DDDIFORMAT getFormatConfig();
|
||||||
std::pair<D3DDDIMULTISAMPLE_TYPE, UINT> getMultisampleConfig();
|
std::pair<D3DDDIMULTISAMPLE_TYPE, UINT> getMultisampleConfig();
|
||||||
SIZE getScaledSize();
|
SIZE getScaledSize();
|
||||||
|
bool isScaled(UINT subResourceIndex);
|
||||||
bool isValidRect(UINT subResourceIndex, const RECT& rect);
|
bool isValidRect(UINT subResourceIndex, const RECT& rect);
|
||||||
void loadFromLockRefResource(UINT subResourceIndex);
|
void loadFromLockRefResource(UINT subResourceIndex);
|
||||||
void loadMsaaResource(UINT subResourceIndex);
|
void loadMsaaResource(UINT subResourceIndex);
|
||||||
@ -155,6 +156,7 @@ namespace D3dDdi
|
|||||||
bool m_isSurfaceRepoResource;
|
bool m_isSurfaceRepoResource;
|
||||||
bool m_isClampable;
|
bool m_isClampable;
|
||||||
bool m_isPrimary;
|
bool m_isPrimary;
|
||||||
|
bool m_isPrimaryScalingNeeded;
|
||||||
bool m_isPalettizedTextureUpToDate;
|
bool m_isPalettizedTextureUpToDate;
|
||||||
bool m_isColorKeyedSurfaceUpToDate;
|
bool m_isColorKeyedSurfaceUpToDate;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user