diff --git a/plugins/GSdx/GSDevice11.cpp b/plugins/GSdx/GSDevice11.cpp index 96787f98b1..968f3d51c8 100644 --- a/plugins/GSdx/GSDevice11.cpp +++ b/plugins/GSdx/GSDevice11.cpp @@ -32,7 +32,8 @@ 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); + FFXA_Compiled = false; + m_state.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; m_state.bf = -1; } @@ -273,6 +274,8 @@ bool GSDevice11::Create(GSWnd* wnd) hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb); + FFXA_Compiled = false; + /* if (Use_FXAA_Shader) { #if EXTERNAL_SHADER_LOADING @@ -286,7 +289,8 @@ bool GSDevice11::Create(GSWnd* wnd) // internal shader CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); #endif - } + FFXA_Compiled = true; + }*/ // memset(&rd, 0, sizeof(rd)); @@ -745,6 +749,20 @@ void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dt) FXAAConstantBuffer cb; + if (!FFXA_Compiled) + { +#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); + } +#else + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); +#endif + FFXA_Compiled = true; + } cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f); cb.rcpFrameOpt = GSVector4::zero(); diff --git a/plugins/GSdx/GSDevice11.h b/plugins/GSdx/GSDevice11.h index 8819bb830b..eb61922c29 100644 --- a/plugins/GSdx/GSDevice11.h +++ b/plugins/GSdx/GSDevice11.h @@ -82,7 +82,7 @@ public: // TODO CComPtr m_rs; bool UserHacks_NVIDIAHack; - bool Use_FXAA_Shader; + bool FFXA_Compiled; struct { diff --git a/plugins/GSdx/GSDevice9.cpp b/plugins/GSdx/GSDevice9.cpp index 72c0ea27f1..0a78f0fac9 100644 --- a/plugins/GSdx/GSDevice9.cpp +++ b/plugins/GSdx/GSDevice9.cpp @@ -28,8 +28,7 @@ GSDevice9::GSDevice9() : m_lost(false) { m_rbswapped = true; - - Use_FXAA_Shader = !!theApp.GetConfig("Fxaa", 0); + FFXA_Compiled = false; memset(&m_pp, 0, sizeof(m_pp)); memset(&m_d3dcaps, 0, sizeof(m_d3dcaps)); @@ -360,6 +359,8 @@ bool GSDevice9::Create(GSWnd* wnd) CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps); + FFXA_Compiled = false; + /* // fxaa if (Use_FXAA_Shader) { @@ -373,7 +374,7 @@ bool GSDevice9::Create(GSWnd* wnd) #else CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); #endif - } + }*/ // create shader layout VSSelector sel; @@ -942,6 +943,21 @@ void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dt) FXAAConstantBuffer cb; + if (!FFXA_Compiled) + { +#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); + } +#else + CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); +#endif + FFXA_Compiled = true; + } + cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f); cb.rcpFrameOpt = GSVector4::zero(); diff --git a/plugins/GSdx/GSDevice9.h b/plugins/GSdx/GSDevice9.h index 2194ededd8..215999bfcc 100644 --- a/plugins/GSdx/GSDevice9.h +++ b/plugins/GSdx/GSDevice9.h @@ -113,7 +113,7 @@ class GSDevice9 : public GSDeviceDX public: // TODO - bool Use_FXAA_Shader; + bool FFXA_Compiled; struct {