gsdx: Fix custom resolution and minor cleanup

This fixes the following issues when custom resolution is selected.
 - When the width is smaller than the native resolution width, the
   texture cache targets are removed on every Vsync signal, causing a
   black screen issue.
 - The texture cache code needs a 1 returned for the custom resolution
   upscale multiplier or there'll be some really funny graphical issues.

It also removes unnecessary GetConfig (which I think unconditionally
does a a file read on Windows) calls if the width was increased - the
upscale multiplier is already stored, and the custom resolution width
and height calls are now unnecessary.

Also fix some whitespace issues.
This commit is contained in:
Jonathan Li 2015-09-20 13:41:21 +01:00 committed by Akash
parent 28191baa80
commit d4f6894e1b
1 changed files with 9 additions and 16 deletions

View File

@ -47,30 +47,22 @@ GSRendererHW::GSRendererHW(GSTextureCache* tc)
}
void GSRendererHW::SetScaling() {
void GSRendererHW::SetScaling()
{
m_buffer_size = max(m_context->FRAME.FBW * 64, m_regs->DISP[m_regs->PMODE.EN1 == 1 ? 0 : 1].DISPFB.FBW * 64);
//Only increase the buffer size, don't make it smaller, it breaks games (GH3)
if (m_upscale_multiplier !=1 && m_width < (m_buffer_size * m_upscale_multiplier)){
// Also don't change the size for custom resolution (m_upscale_multiplier = 9).
if (m_upscale_multiplier != 9 && m_width < (m_buffer_size * m_upscale_multiplier)) {
m_tc->RemovePartial();
}
else {
} else {
return;
}
m_height = m_buffer_size < 1024 ? 512 : 1024;
m_upscale_multiplier = theApp.GetConfig("upscale_multiplier", m_upscale_multiplier);
if (m_upscale_multiplier == 9) { //Custom Resolution
m_width = theApp.GetConfig("resx", m_width);
m_height = theApp.GetConfig("resy", m_height);
}
if (m_upscale_multiplier > 1 && m_upscale_multiplier !=9)
{
if (m_upscale_multiplier > 1) {
m_width = m_buffer_size * m_upscale_multiplier;
m_height *= m_upscale_multiplier;
}
@ -103,7 +95,8 @@ bool GSRendererHW::CanUpscale()
int GSRendererHW::GetUpscaleMultiplier()
{
return m_upscale_multiplier;
// Custom resolution (currently 9) needs an upscale multiplier of 1.
return m_upscale_multiplier != 9? m_upscale_multiplier: 1;
}
void GSRendererHW::Reset()