mirror of https://github.com/PCSX2/pcsx2.git
Merge pull request #1728 from ssakash/custom_regression
GSDX-TextureCache: Fix corner cases on custom resolution scaling
This commit is contained in:
commit
98e8d93fa3
|
@ -405,7 +405,7 @@ GSVideoMode GSState::GetVideoMode()
|
|||
return videomode;
|
||||
}
|
||||
|
||||
GSVector4i GSState::GetDisplayRect(int i)
|
||||
GSVector4i GSState::GetDisplayRect(int i, bool merged_rect)
|
||||
{
|
||||
if(i < 0) i = IsEnabled(1) ? 1 : 0;
|
||||
|
||||
|
@ -433,8 +433,16 @@ GSVector4i GSState::GetDisplayRect(int i)
|
|||
rectangle.right = rectangle.left + width;
|
||||
rectangle.bottom = rectangle.top + height;
|
||||
|
||||
// Useful for debugging games:
|
||||
//printf("DW: %d , DH: %d , left: %d , right: %d , top: %d , down: %d , MAGH: %d , MAGV: %d\n", m_regs->DISP[i].DISPLAY.DW, m_regs->DISP[i].DISPLAY.DH, r.left, r.right, r.top, r.bottom , m_regs->DISP[i].DISPLAY.MAGH,m_regs->DISP[i].DISPLAY.MAGV);
|
||||
if ((m_regs->PMODE.EN1 & m_regs->PMODE.EN2) && merged_rect)
|
||||
{
|
||||
GSVector4i opposite_output = GetDisplayRect(!i);
|
||||
GSVector4i r_intersect = opposite_output.rintersect(rectangle);
|
||||
GSVector4i r_union = opposite_output.runion_ordered(rectangle);
|
||||
|
||||
if(!(r_intersect.width() && r_intersect.height()) ||
|
||||
r_intersect.xyxy().eq(r_union.xyxy()))
|
||||
return r_union;
|
||||
}
|
||||
|
||||
return rectangle;
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
|
||||
void ResetHandlers();
|
||||
|
||||
GSVector4i GetDisplayRect(int i = -1);
|
||||
GSVector4i GetDisplayRect(int i = -1, bool merged_rect = false);
|
||||
GSVector4i GetFrameRect(int i = -1);
|
||||
GSVideoMode GetVideoMode();
|
||||
|
||||
|
|
|
@ -414,13 +414,8 @@ void GSTextureCache::ScaleTexture(GSTexture* texture)
|
|||
|
||||
if (custom_resolution)
|
||||
{
|
||||
int width = m_renderer->GetDisplayRect().width();
|
||||
int height = m_renderer->GetDisplayRect().height();
|
||||
int real_height = static_cast<int>(round(m_renderer->GetInternalResolution().y / texture->GetScale().y));
|
||||
|
||||
// Fixes offset issues on Persona 3 (512x511) where real value of height is 512
|
||||
if (real_height % height == 1)
|
||||
height = real_height;
|
||||
int width = m_renderer->GetDisplayRect(-1, true).width();
|
||||
int height = m_renderer->GetDisplayRect(-1, true).height();
|
||||
|
||||
GSVector2i requested_resolution = m_renderer->GetCustomResolution();
|
||||
scale_factor.x = static_cast<float>(requested_resolution.x) / width;
|
||||
|
|
Loading…
Reference in New Issue