diff options
| author | Markus Wick <markus+github@selfnet.de> | 2015-01-26 11:08:29 +0100 |
|---|---|---|
| committer | Markus Wick <markus+github@selfnet.de> | 2015-01-26 11:08:29 +0100 |
| commit | 53a9df10f9d7a53bce947a0fdc43e6d3c482bf86 (patch) | |
| tree | 6983b4fcc6a0622a6602c041b50d2b8223643e2f /Source/Core/VideoCommon/PostProcessing.cpp | |
| parent | 5ba1319abbcfc8bd4449a1b5581c6020b28d9b7f (diff) | |
| parent | 5c4ee2f71e2e1c80ba2bf829751f1202f6e65ee9 (diff) | |
Merge pull request #1817 from Armada651/custom-anaglyph
PostProcessing: Add support for user-supplied anaglyph shaders.
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PostProcessing.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index b4ee1e8702..c299d41b15 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -13,6 +13,8 @@ #include "VideoCommon/VideoConfig.h" +static const char s_default_shader[] = "void main() { SetOutput(Sample()); }\n"; + PostProcessingShaderImplementation::PostProcessingShaderImplementation() { m_timer.Start(); @@ -30,20 +32,29 @@ std::string PostProcessingShaderConfiguration::LoadShader(std::string shader) shader = g_ActiveConfig.sPostProcessingShader; m_current_shader = shader; + const std::string sub_dir = (g_Config.iStereoMode == STEREO_ANAGLYPH) ? ANAGLYPH_DIR DIR_SEP : ""; + // loading shader code std::string code; - std::string path = File::GetUserPath(D_SHADERS_IDX) + shader + ".glsl"; + std::string path = File::GetUserPath(D_SHADERS_IDX) + sub_dir + shader + ".glsl"; - if (!File::Exists(path)) + if (shader == "") { - // Fallback to shared user dir - path = File::GetSysDirectory() + SHADERS_DIR DIR_SEP + shader + ".glsl"; + code = s_default_shader; } - - if (!File::ReadFileToString(path, code)) + else { - ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str()); - return ""; + if (!File::Exists(path)) + { + // Fallback to shared user dir + path = File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir + shader + ".glsl"; + } + + if (!File::ReadFileToString(path, code)) + { + ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str()); + code = s_default_shader; + } } LoadOptions(code); |
