summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2017-04-28 22:50:14 +1000
committerGitHub <noreply@github.com>2017-04-28 22:50:14 +1000
commit68ee4fc932ddff320f535b6054ceff0c58348b64 (patch)
tree937bda8967539f3dfbc15133b9e78fbfba4a555c /Source/Core/VideoCommon
parentf2035384e5e03ec86abefeb7ab24fa1fc3dd8f39 (diff)
parent27ae5b8d34675244af689b260f0dbb391bb6209e (diff)
Merge pull request #5296 from stenzek/vulkan-postprocessing
Vulkan: Implement support for post-processing
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/PostProcessing.cpp35
-rw-r--r--Source/Core/VideoCommon/PostProcessing.h9
-rw-r--r--Source/Core/VideoCommon/VideoConfig.h2
3 files changed, 39 insertions, 7 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 74628c3e54..4a51e66842 100644
--- a/Source/Core/VideoCommon/PostProcessing.h
+++ b/Source/Core/VideoCommon/PostProcessing.h
@@ -60,6 +60,7 @@ public:
bool IsDirty() { return m_any_options_dirty; }
void SetDirty(bool dirty) { m_any_options_dirty = dirty; }
bool HasOptions() { return m_options.size() > 0; }
+ const ConfigMap& GetOptions() const { return m_options; }
ConfigMap& GetOptions() { return m_options; }
const ConfigurationOption& GetOption(const std::string& option) { return m_options[option]; }
// For updating option's values
@@ -82,12 +83,10 @@ public:
PostProcessingShaderImplementation();
virtual ~PostProcessingShaderImplementation();
- PostProcessingShaderConfiguration* GetConfig() { return &m_config; }
- // Should be implemented by the backends for backend specific code
- virtual void BlitFromTexture(TargetRectangle src, TargetRectangle dst, int src_texture,
- int src_width, int src_height, int layer = 0) = 0;
- virtual void ApplyShader() = 0;
+ 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
Common::Timer m_timer;
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