diff options
Diffstat (limited to 'Source/Core/VideoCommon/PostProcessing.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PostProcessing.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/PostProcessing.cpp b/Source/Core/VideoCommon/PostProcessing.cpp index 023b6ef8bc..71f38732e7 100644 --- a/Source/Core/VideoCommon/PostProcessing.cpp +++ b/Source/Core/VideoCommon/PostProcessing.cpp @@ -7,6 +7,7 @@ #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" +#include "Common/FileSearch.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Common/Logging/Log.h" @@ -27,6 +28,40 @@ PostProcessingShaderImplementation::~PostProcessingShaderImplementation() m_timer.Stop(); } +static std::vector<std::string> GetShaders(const std::string& sub_dir = "") +{ + std::vector<std::string> paths = + Common::DoFileSearch({".glsl"}, {File::GetUserPath(D_SHADERS_IDX) + sub_dir, + File::GetSysDirectory() + SHADERS_DIR DIR_SEP + sub_dir}); + std::vector<std::string> result; + for (std::string path : paths) + { + std::string name; + SplitPath(path, nullptr, &name, nullptr); + result.push_back(name); + } + return result; +} + +std::vector<std::string> PostProcessingShaderImplementation::GetShaderList(APIType api_type) +{ + // Currently there is no differentiation between API types and shader languages. + // This could change in the future, hence the api_type parameter, but ideally, + // shaders should be compatible across backends. + if (api_type == APIType::OpenGL || api_type == APIType::Vulkan) + return GetShaders(); + + return {}; +} + +std::vector<std::string> PostProcessingShaderImplementation::GetAnaglyphShaderList(APIType api_type) +{ + if (api_type == APIType::OpenGL || api_type == APIType::Vulkan) + return GetShaders(ANAGLYPH_DIR DIR_SEP); + + return {}; +} + std::string PostProcessingShaderConfiguration::LoadShader(std::string shader) { // Load the shader from the configuration if there isn't one sent to us. |
