summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-04-21 23:59:45 +1000
committerStenzek <stenzek@gmail.com>2017-04-25 14:27:05 +1000
commit27ae5b8d34675244af689b260f0dbb391bb6209e (patch)
tree8b35c323b5041d2944f26e0104cab166ea6ac6ec /Source/Core/VideoCommon
parent417a4ca206a5cae7cc08c80564181af74c8fa51a (diff)
VideoConfigDiag: Move post-processing shader list to post processor
The backends don't use this list at all, and since more than one backend supports post-processing now, it's duplicate code.
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/PostProcessing.cpp35
-rw-r--r--Source/Core/VideoCommon/PostProcessing.h3
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h2
3 files changed, 38 insertions, 2 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.
diff --git a/Source/Core/VideoCommon/PostProcessing.h b/Source/Core/VideoCommon/PostProcessing.h
index 02ed1b5f7b..4a51e66842 100644
--- a/Source/Core/VideoCommon/PostProcessing.h
+++ b/Source/Core/VideoCommon/PostProcessing.h
@@ -83,6 +83,9 @@ public:
PostProcessingShaderImplementation();
virtual ~PostProcessingShaderImplementation();
+ static std::vector<std::string> GetShaderList(APIType api_type);
+ static std::vector<std::string> GetAnaglyphShaderList(APIType api_type);
+
PostProcessingShaderConfiguration* GetConfig() { return &m_config; }
protected:
// Timer for determining our time value
diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h
index c628722a3a..eacb30d8b1 100644
--- a/Source/Core/VideoCommon/VideoConfig.h
+++ b/Source/Core/VideoCommon/VideoConfig.h
@@ -170,8 +170,6 @@ struct VideoConfig final
std::vector<std::string> Adapters; // for D3D
std::vector<int> AAModes;
- std::vector<std::string> PPShaders; // post-processing shaders
- std::vector<std::string> AnaglyphShaders; // anaglyph shaders
// TODO: merge AdapterName and Adapters array
std::string AdapterName; // for OpenGL