Post-processing: Added options to graphics config dialog.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3391 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-06-09 19:40:47 +00:00
parent d124ceaf92
commit df91fc8648
8 changed files with 142 additions and 33 deletions

View File

@ -38,16 +38,20 @@ void Shutdown()
s_shader.Destroy();
}
void ApplyShader()
void ReloadShader()
{
s_currentShader = "";
}
bool ApplyShader()
{
#ifdef _WIN32
if (GetAsyncKeyState(VK_LSHIFT))
s_currentShader = "";
#endif
if (s_currentShader != "User/Shaders/" + g_Config.sPostProcessingShader + ".txt")
{
// Set immediately to prevent endless recompiles on failure.
s_currentShader = "User/Shaders/" + g_Config.sPostProcessingShader + ".txt";
if (!g_Config.sPostProcessingShader.empty())
s_currentShader = "User/Shaders/" + g_Config.sPostProcessingShader + ".txt";
else
s_currentShader.clear();
s_shader.Destroy();
@ -66,22 +70,20 @@ void ApplyShader()
ERROR_LOG(VIDEO, "Failed to load post-processing shader %s - does not exist?", s_currentShader.c_str());
}
}
else
{
ERROR_LOG(VIDEO, "No post-processing shader selected.");
}
}
if (s_shader.glprogid == 0)
if (s_shader.glprogid != 0)
{
ERROR_LOG(VIDEO, "WTF");
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, s_shader.glprogid);
return true;
}
else
{
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_FRAGMENT_PROGRAM_ARB);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
return false;
}
// If anything went wrong above, glprogid will be 0, which is OK.
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, s_shader.glprogid);
}
} // namespace