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.
This commit is contained in:
parent
417a4ca206
commit
27ae5b8d34
|
@ -1253,9 +1253,10 @@ void VideoConfigDiag::CreateDescriptionArea(wxPanel* const page, wxBoxSizer* con
|
||||||
|
|
||||||
void VideoConfigDiag::PopulatePostProcessingShaders()
|
void VideoConfigDiag::PopulatePostProcessingShaders()
|
||||||
{
|
{
|
||||||
std::vector<std::string>& shaders = (vconfig.iStereoMode == STEREO_ANAGLYPH) ?
|
std::vector<std::string> shaders =
|
||||||
vconfig.backend_info.AnaglyphShaders :
|
vconfig.iStereoMode == STEREO_ANAGLYPH ?
|
||||||
vconfig.backend_info.PPShaders;
|
PostProcessingShaderImplementation::GetAnaglyphShaderList(vconfig.backend_info.api_type) :
|
||||||
|
PostProcessingShaderImplementation::GetShaderList(vconfig.backend_info.api_type);
|
||||||
|
|
||||||
if (shaders.empty())
|
if (shaders.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -128,10 +128,6 @@ void VideoBackend::InitBackendInfo()
|
||||||
}
|
}
|
||||||
factory->Release();
|
factory->Release();
|
||||||
|
|
||||||
// Clear ppshaders string vector
|
|
||||||
g_Config.backend_info.PPShaders.clear();
|
|
||||||
g_Config.backend_info.AnaglyphShaders.clear();
|
|
||||||
|
|
||||||
DX11::D3D::UnloadDXGI();
|
DX11::D3D::UnloadDXGI();
|
||||||
DX11::D3D::UnloadD3D();
|
DX11::D3D::UnloadD3D();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,10 +140,6 @@ void VideoBackend::InitBackendInfo()
|
||||||
}
|
}
|
||||||
factory->Release();
|
factory->Release();
|
||||||
|
|
||||||
// Clear ppshaders string vector
|
|
||||||
g_Config.backend_info.PPShaders.clear();
|
|
||||||
g_Config.backend_info.AnaglyphShaders.clear();
|
|
||||||
|
|
||||||
D3D::UnloadD3D();
|
D3D::UnloadD3D();
|
||||||
D3D::UnloadDXGI();
|
D3D::UnloadDXGI();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,6 @@ void VideoBackend::InitBackendInfo()
|
||||||
// aamodes: We only support 1 sample, so no MSAA
|
// aamodes: We only support 1 sample, so no MSAA
|
||||||
g_Config.backend_info.Adapters.clear();
|
g_Config.backend_info.Adapters.clear();
|
||||||
g_Config.backend_info.AAModes = {1};
|
g_Config.backend_info.AAModes = {1};
|
||||||
g_Config.backend_info.PPShaders.clear();
|
|
||||||
g_Config.backend_info.AnaglyphShaders.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoBackend::Initialize(void* window_handle)
|
bool VideoBackend::Initialize(void* window_handle)
|
||||||
|
|
|
@ -38,8 +38,6 @@ Make AA apply instantly during gameplay if possible
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common/CommonPaths.h"
|
|
||||||
#include "Common/FileSearch.h"
|
|
||||||
#include "Common/GL/GLInterfaceBase.h"
|
#include "Common/GL/GLInterfaceBase.h"
|
||||||
#include "Common/GL/GLUtil.h"
|
#include "Common/GL/GLUtil.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
@ -79,21 +77,6 @@ std::string VideoBackend::GetDisplayName() const
|
||||||
return "OpenGL";
|
return "OpenGL";
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VideoBackend::InitBackendInfo()
|
void VideoBackend::InitBackendInfo()
|
||||||
{
|
{
|
||||||
g_Config.backend_info.api_type = APIType::OpenGL;
|
g_Config.backend_info.api_type = APIType::OpenGL;
|
||||||
|
@ -125,10 +108,6 @@ void VideoBackend::InitBackendInfo()
|
||||||
|
|
||||||
// aamodes - 1 is to stay consistent with D3D (means no AA)
|
// aamodes - 1 is to stay consistent with D3D (means no AA)
|
||||||
g_Config.backend_info.AAModes = {1, 2, 4, 8};
|
g_Config.backend_info.AAModes = {1, 2, 4, 8};
|
||||||
|
|
||||||
// pp shaders
|
|
||||||
g_Config.backend_info.PPShaders = GetShaders("");
|
|
||||||
g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoBackend::InitializeGLExtensions()
|
bool VideoBackend::InitializeGLExtensions()
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/CommonFuncs.h"
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonPaths.h"
|
|
||||||
#include "Common/FileSearch.h"
|
|
||||||
#include "Common/FileUtil.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
@ -225,21 +222,6 @@ VulkanContext::GPUList VulkanContext::EnumerateGPUs(VkInstance instance)
|
||||||
return gpus;
|
return gpus;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VulkanContext::PopulateBackendInfo(VideoConfig* config)
|
void VulkanContext::PopulateBackendInfo(VideoConfig* config)
|
||||||
{
|
{
|
||||||
config->backend_info.api_type = APIType::Vulkan;
|
config->backend_info.api_type = APIType::Vulkan;
|
||||||
|
@ -264,9 +246,6 @@ void VulkanContext::PopulateBackendInfo(VideoConfig* config)
|
||||||
config->backend_info.bSupportsSSAA = false; // Dependent on features.
|
config->backend_info.bSupportsSSAA = false; // Dependent on features.
|
||||||
config->backend_info.bSupportsDepthClamp = false; // Dependent on features.
|
config->backend_info.bSupportsDepthClamp = false; // Dependent on features.
|
||||||
config->backend_info.bSupportsReversedDepthRange = false; // No support yet due to driver bugs.
|
config->backend_info.bSupportsReversedDepthRange = false; // No support yet due to driver bugs.
|
||||||
|
|
||||||
g_Config.backend_info.PPShaders = GetShaders("");
|
|
||||||
g_Config.backend_info.AnaglyphShaders = GetShaders(ANAGLYPH_DIR DIR_SEP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list)
|
void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/FileSearch.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
@ -27,6 +28,40 @@ PostProcessingShaderImplementation::~PostProcessingShaderImplementation()
|
||||||
m_timer.Stop();
|
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)
|
std::string PostProcessingShaderConfiguration::LoadShader(std::string shader)
|
||||||
{
|
{
|
||||||
// Load the shader from the configuration if there isn't one sent to us.
|
// Load the shader from the configuration if there isn't one sent to us.
|
||||||
|
|
|
@ -83,6 +83,9 @@ public:
|
||||||
PostProcessingShaderImplementation();
|
PostProcessingShaderImplementation();
|
||||||
virtual ~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; }
|
PostProcessingShaderConfiguration* GetConfig() { return &m_config; }
|
||||||
protected:
|
protected:
|
||||||
// Timer for determining our time value
|
// Timer for determining our time value
|
||||||
|
|
|
@ -170,8 +170,6 @@ struct VideoConfig final
|
||||||
|
|
||||||
std::vector<std::string> Adapters; // for D3D
|
std::vector<std::string> Adapters; // for D3D
|
||||||
std::vector<int> AAModes;
|
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
|
// TODO: merge AdapterName and Adapters array
|
||||||
std::string AdapterName; // for OpenGL
|
std::string AdapterName; // for OpenGL
|
||||||
|
|
Loading…
Reference in New Issue