GSDX-TC: Pass merged output size for scaling

Passes the merged output circuit as the base size for texture cache scaling code. Helps fixing scaling issues where games use both of the output circuits for rendering.

Future Note: Alter the behavior of IsEnabled() check always preferring the second output circuit for some weird reason. I plan on changing it to a better auto-output circuit selection mechanism but that could probably be done some time in the future.
This commit is contained in:
Akash 2016-12-31 19:46:40 +05:30
parent 761ce60a8e
commit b56ff3fce7
3 changed files with 14 additions and 6 deletions

View File

@ -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;
}

View File

@ -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();

View File

@ -414,8 +414,8 @@ void GSTextureCache::ScaleTexture(GSTexture* texture)
if (custom_resolution)
{
int width = m_renderer->GetDisplayRect().width();
int height = m_renderer->GetDisplayRect().height();
int width = m_renderer->GetDisplayRect(-1, true).width();
int height = m_renderer->GetDisplayRect(-1, true).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