From 5e22971db0cce9b31b17dff816d4e1bd3ecee88f Mon Sep 17 00:00:00 2001 From: refraction Date: Mon, 6 Jan 2014 22:51:45 +0000 Subject: [PATCH] GSDX: New shader is quite slow to compile, so lets not compile it unless the user is using it :) -switching between sw/hw modes, resuming emulation speed back to normal. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5799 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSDevice11.cpp | 21 ++++++++++++--------- plugins/GSdx/GSDevice11.h | 1 + plugins/GSdx/GSDevice9.cpp | 19 ++++++++++++------- plugins/GSdx/GSDevice9.h | 2 ++ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index c08bad8d2c..96787f98b1 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -32,7 +32,7 @@ GSDevice11::GSDevice11() memset(&m_ps_cb_cache, 0, sizeof(m_ps_cb_cache)); UserHacks_NVIDIAHack = !!theApp.GetConfig("UserHacks_NVIDIAHack", 0) && !!theApp.GetConfig("UserHacks", 0); - + Use_FXAA_Shader = !!theApp.GetConfig("Fxaa", 0); m_state.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; m_state.bf = -1; } @@ -273,17 +273,20 @@ bool GSDevice11::Create(GSWnd* wnd) hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb); + if (Use_FXAA_Shader) + { #if EXTERNAL_SHADER_LOADING - try { - CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); - } - catch (GSDXRecoverableError) { - CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); - } + try { + CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); + } + catch (GSDXRecoverableError) { + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); + } #else - // internal shader - CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); + // internal shader + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); #endif + } // memset(&rd, 0, sizeof(rd)); diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 5e6e3b3b0d..8819bb830b 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -82,6 +82,7 @@ public: // TODO CComPtr m_rs; bool UserHacks_NVIDIAHack; + bool Use_FXAA_Shader; struct { diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 7fe774601d..72c0ea27f1 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -29,6 +29,8 @@ GSDevice9::GSDevice9() { m_rbswapped = true; + Use_FXAA_Shader = !!theApp.GetConfig("Fxaa", 0); + memset(&m_pp, 0, sizeof(m_pp)); memset(&m_d3dcaps, 0, sizeof(m_d3dcaps)); memset(&m_state, 0, sizeof(m_state)); @@ -359,16 +361,19 @@ bool GSDevice9::Create(GSWnd* wnd) CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps); // fxaa + if (Use_FXAA_Shader) + { #if EXTERNAL_SHADER_LOADING - try { - CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); - } - catch (GSDXRecoverableError) { - CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); - } + try { + CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); + } + catch (GSDXRecoverableError) { + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); + } #else - CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); #endif + } // create shader layout VSSelector sel; diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 249ce69c34..2194ededd8 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -113,6 +113,8 @@ class GSDevice9 : public GSDeviceDX public: // TODO + bool Use_FXAA_Shader; + struct { CComPtr il;