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
This commit is contained in:
refraction 2014-01-06 22:51:45 +00:00
parent a1e387e23e
commit 5e22971db0
4 changed files with 27 additions and 16 deletions

View File

@ -32,7 +32,7 @@ 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);
m_state.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; m_state.topology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
m_state.bf = -1; m_state.bf = -1;
} }
@ -273,17 +273,20 @@ bool GSDevice11::Create(GSWnd* wnd)
hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb); hr = m_dev->CreateBuffer(&bd, NULL, &m_fxaa.cb);
if (Use_FXAA_Shader)
{
#if EXTERNAL_SHADER_LOADING #if EXTERNAL_SHADER_LOADING
try { try {
CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps);
} }
catch (GSDXRecoverableError) { catch (GSDXRecoverableError) {
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
} }
#else #else
// 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
}
// //
memset(&rd, 0, sizeof(rd)); memset(&rd, 0, sizeof(rd));

View File

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

View File

@ -29,6 +29,8 @@ GSDevice9::GSDevice9()
{ {
m_rbswapped = true; m_rbswapped = true;
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));
memset(&m_state, 0, sizeof(m_state)); 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); CompileShader(IDR_SHADEBOOST_FX, "ps_main", macro, &m_shadeboost.ps);
// fxaa // fxaa
if (Use_FXAA_Shader)
{
#if EXTERNAL_SHADER_LOADING #if EXTERNAL_SHADER_LOADING
try { try {
CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps); CompileShader("shader.fx", "ps_main", NULL, &m_fxaa.ps);
} }
catch (GSDXRecoverableError) { catch (GSDXRecoverableError) {
CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps); CompileShader(IDR_FXAA_FX, "ps_main", NULL, &m_fxaa.ps);
} }
#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;

View File

@ -113,6 +113,8 @@ class GSDevice9 : public GSDeviceDX
public: // TODO public: // TODO
bool Use_FXAA_Shader;
struct struct
{ {
CComPtr<IDirect3DVertexDeclaration9> il; CComPtr<IDirect3DVertexDeclaration9> il;