From 98a705879465a186db3cf54519afdf474c859eae Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 21 Jun 2015 12:00:26 +0100 Subject: [PATCH 1/3] Remove 'Disable vsync in software rendering' code PCSX2 doesn't know whether it is in hardware or software mode. So this code does not work if the user is using software rendering mode without F9 toggling. Don't disable vsync if the user toggles rendering mode. --- pcsx2/MTGS.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index acd739fa1b..784f209d43 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -192,25 +192,13 @@ void SysMtgsThread::OpenPlugin() else result = GSopen( (void*)pDsp, "PCSX2", renderswitch ? 2 : 1 ); - // Vsync on / off ? if( renderswitch ) { Console.Indent(2).WriteLn( "Toggling GSdx Hardware/Software renderer" ); - if ( EmuConfig.GS.VsyncEnable ) - { - // Better turn Vsync off now, as in most cases sw rendering is not fast enough to support a steady 60fps. - // Having Vsync still enabled then means a big cut in speed and sloppy rendering. - // It's possible though that some users have very fast machines, and rather kept Vsync enabled, - // but let's assume this is the minority. At least for now ;) - GSsetVsync( false ); - Console.Indent(2).WriteLn( "Vsync temporarily disabled" ); - } - } - else - { - GSsetVsync( EmuConfig.GS.FrameLimitEnable && EmuConfig.GS.VsyncEnable ); } + GSsetVsync(EmuConfig.GS.FrameLimitEnable && EmuConfig.GS.VsyncEnable); + if( result != 0 ) { DevCon.WriteLn( "GSopen Failed: return code: 0x%x", result ); From bfa46b7f54e7ff77c4f1fc5a4f90e3fcd2149f27 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 21 Jun 2015 12:24:58 +0100 Subject: [PATCH 2/3] Fix when the toggling message appears Make the toggling message appear only when F9 is actually pressed. --- pcsx2/MTGS.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index 784f209d43..4bdf671d84 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -179,6 +179,8 @@ static void dummyIrqCallback() void SysMtgsThread::OpenPlugin() { + static bool stored_renderswitch = false; + if( m_PluginOpened ) return; memcpy( RingBuffer.Regs, PS2MEM_GS, sizeof(PS2MEM_GS) ); @@ -192,8 +194,9 @@ void SysMtgsThread::OpenPlugin() else result = GSopen( (void*)pDsp, "PCSX2", renderswitch ? 2 : 1 ); - if( renderswitch ) + if( stored_renderswitch != renderswitch ) { + stored_renderswitch = renderswitch; Console.Indent(2).WriteLn( "Toggling GSdx Hardware/Software renderer" ); } From acc6ad59ba4d0a9841aa97a05c26bbc5ef2f900f Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sun, 21 Jun 2015 15:03:17 +0100 Subject: [PATCH 3/3] GSdx: Use correct renderer after config change Rework the renderer selection logic to reload the saved renderer after it's been changed in the config panel and to properly detect whether a renderer toggle has been requested. --- plugins/GSdx/GS.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index f250547c53..d29b3b98d1 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -445,17 +445,24 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) EXPORT_C_(int) GSopen2(void** dsp, uint32 flags) { -#ifdef __linux__ - // Use ogl renderer as default otherwise it crash at startup - // GSRenderOGL only GSDeviceOGL (not GSDeviceNULL) - int renderer = theApp.GetConfig("Renderer", 12); -#else - int renderer = theApp.GetConfig("Renderer", 0); -#endif + static bool stored_toggle_state = false; + bool toggle_state = !!(flags & 4); - if(flags & 4) + int renderer = s_renderer; + // Fresh start up or config file changed + if (renderer == -1) { -#ifdef _WINDOWS +#ifdef __linux__ + // Use ogl renderer as default otherwise it crash at startup + // GSRenderOGL only GSDeviceOGL (not GSDeviceNULL) + renderer = theApp.GetConfig("Renderer", 12); +#else + renderer = theApp.GetConfig("Renderer", 0); +#endif + } + else if (stored_toggle_state != toggle_state) + { +#ifdef _WIN32 int best_sw_renderer = GSUtil::CheckDirect3D11Level() >= D3D_FEATURE_LEVEL_10_0 ? 4 : 1; // dx11 / dx9 sw switch(renderer){ @@ -477,6 +484,7 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags) } #endif } + stored_toggle_state = toggle_state; int retval = _GSopen(dsp, NULL, renderer); @@ -761,17 +769,19 @@ EXPORT_C GSconfigure() GSshutdown(); } + // Force a reload of the gs state + s_renderer = -1; } #else if (RunLinuxDialog()) { theApp.ReloadConfig(); + // Force a reload of the gs state + s_renderer = -1; } #endif - // Force a reload of the gs state - s_renderer = -1; } catch (GSDXRecoverableError) {