GSDX: Modified the FXAA shader loading so Page Up works again. Now loads the shader just in time.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5801 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
refraction 2014-01-07 23:53:30 +00:00
parent b13c00f42d
commit 5aa0a9a94d
4 changed files with 41 additions and 7 deletions

View File

@ -32,7 +32,8 @@ GSDevice11::GSDevice11()
memset(&m_ps_cb_cache, 0, sizeof(m_ps_cb_cache)); memset(&m_ps_cb_cache, 0, sizeof(m_ps_cb_cache));
UserHacks_NVIDIAHack = !!theApp.GetConfig("UserHacks_NVIDIAHack", 0) && !!theApp.GetConfig("UserHacks", 0); 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.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
m_state.bf = -1; m_state.bf = -1;
} }
@ -273,6 +274,8 @@ bool GSDevice11::Create(GSWnd* wnd)
hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb); hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb);
FFXA_Compiled = false;
/*
if (Use_FXAA_Shader) if (Use_FXAA_Shader)
{ {
#if EXTERNAL_SHADER_LOADING #if EXTERNAL_SHADER_LOADING
@ -286,7 +289,8 @@ bool GSDevice11::Create(GSWnd* wnd)
// internal shader // internal shader
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
#endif #endif
} FFXA_Compiled = true;
}*/
// //
memset(&rd, 0, sizeof(rd)); memset(&rd, 0, sizeof(rd));
@ -745,6 +749,20 @@ void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dt)
FXAAConstantBuffer cb; 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.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
cb.rcpFrameOpt = GSVector4::zero(); cb.rcpFrameOpt = GSVector4::zero();

View File

@ -82,7 +82,7 @@ public: // TODO
CComPtr<ID3D11RasterizerState> m_rs; CComPtr<ID3D11RasterizerState> m_rs;
bool UserHacks_NVIDIAHack; bool UserHacks_NVIDIAHack;
bool Use_FXAA_Shader; bool FFXA_Compiled;
struct struct
{ {

View File

@ -28,8 +28,7 @@ GSDevice9::GSDevice9()
: m_lost(false) : m_lost(false)
{ {
m_rbswapped = true; m_rbswapped = true;
FFXA_Compiled = false;
Use_FXAA_Shader = !!theApp.GetConfig("Fxaa", 0);
memset(&m_pp, 0, sizeof(m_pp)); memset(&m_pp, 0, sizeof(m_pp));
memset(&m_d3dcaps, 0, sizeof(m_d3dcaps)); 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); CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
FFXA_Compiled = false;
/*
// fxaa // fxaa
if (Use_FXAA_Shader) if (Use_FXAA_Shader)
{ {
@ -373,7 +374,7 @@ bool GSDevice9::Create(GSWnd* wnd)
#else #else
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
#endif #endif
} }*/
// create shader layout // create shader layout
VSSelector sel; VSSelector sel;
@ -942,6 +943,21 @@ void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dt)
FXAAConstantBuffer cb; 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.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
cb.rcpFrameOpt = GSVector4::zero(); cb.rcpFrameOpt = GSVector4::zero();

View File

@ -113,7 +113,7 @@ class GSDevice9 : public GSDeviceDX
public: // TODO public: // TODO
bool Use_FXAA_Shader; bool FFXA_Compiled;
struct struct
{ {