From d4f6894e1b2ab4fe665f0e216c8693216da8eef7 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 20 Sep 2015 13:41:21 +0100 Subject: [PATCH] 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. --- plugins/GSdx/GSRendererHW.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index ff0978d6a9..8876743cd4 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -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()