mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Move most backend functionality to VideoCommon
This commit is contained in:
@ -10,9 +10,16 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "VideoCommon/TextureConfig.h"
|
||||
#include "VideoCommon/VideoCommon.h"
|
||||
|
||||
class PostProcessingShaderConfiguration
|
||||
class AbstractTexture;
|
||||
class AbstractPipeline;
|
||||
class AbstractShader;
|
||||
|
||||
namespace VideoCommon
|
||||
{
|
||||
class PostProcessingConfiguration
|
||||
{
|
||||
public:
|
||||
struct ConfigurationOption
|
||||
@ -48,16 +55,17 @@ public:
|
||||
|
||||
using ConfigMap = std::map<std::string, ConfigurationOption>;
|
||||
|
||||
PostProcessingShaderConfiguration();
|
||||
virtual ~PostProcessingShaderConfiguration();
|
||||
PostProcessingConfiguration();
|
||||
virtual ~PostProcessingConfiguration();
|
||||
|
||||
// Loads the configuration with a shader
|
||||
// If the argument is "" the class will load the shader from the g_activeConfig option.
|
||||
// Returns the loaded shader source from file
|
||||
std::string LoadShader(std::string shader = "");
|
||||
void LoadShader(const std::string& shader);
|
||||
void LoadDefaultShader();
|
||||
void SaveOptionsConfiguration();
|
||||
void ReloadShader();
|
||||
const std::string& GetShader() const { return m_current_shader; }
|
||||
const std::string& GetShaderCode() const { return m_current_shader_code; }
|
||||
bool IsDirty() const { return m_any_options_dirty; }
|
||||
void SetDirty(bool dirty) { m_any_options_dirty = dirty; }
|
||||
bool HasOptions() const { return m_options.size() > 0; }
|
||||
@ -72,26 +80,53 @@ public:
|
||||
private:
|
||||
bool m_any_options_dirty = false;
|
||||
std::string m_current_shader;
|
||||
std::string m_current_shader_code;
|
||||
ConfigMap m_options;
|
||||
|
||||
void LoadOptions(const std::string& code);
|
||||
void LoadOptionsConfiguration();
|
||||
};
|
||||
|
||||
class PostProcessingShaderImplementation
|
||||
class PostProcessing
|
||||
{
|
||||
public:
|
||||
PostProcessingShaderImplementation();
|
||||
virtual ~PostProcessingShaderImplementation();
|
||||
PostProcessing();
|
||||
virtual ~PostProcessing();
|
||||
|
||||
static std::vector<std::string> GetShaderList(APIType api_type);
|
||||
static std::vector<std::string> GetAnaglyphShaderList(APIType api_type);
|
||||
static std::vector<std::string> GetShaderList();
|
||||
static std::vector<std::string> GetAnaglyphShaderList();
|
||||
|
||||
PostProcessingShaderConfiguration* GetConfig() { return &m_config; }
|
||||
PostProcessingConfiguration* GetConfig() { return &m_config; }
|
||||
|
||||
bool Initialize(AbstractTextureFormat format);
|
||||
|
||||
void RecompileShader();
|
||||
void RecompilePipeline();
|
||||
|
||||
void BlitFromTexture(const MathUtil::Rectangle<int>& dst, const MathUtil::Rectangle<int>& src,
|
||||
const AbstractTexture* src_tex, int src_layer);
|
||||
|
||||
protected:
|
||||
std::string GetUniformBufferHeader() const;
|
||||
std::string GetHeader() const;
|
||||
std::string GetFooter() const;
|
||||
|
||||
bool CompileVertexShader();
|
||||
bool CompilePixelShader();
|
||||
bool CompilePipeline();
|
||||
|
||||
size_t CalculateUniformsSize() const;
|
||||
void FillUniformBuffer(const MathUtil::Rectangle<int>& src, const AbstractTexture* src_tex,
|
||||
int src_layer);
|
||||
|
||||
// Timer for determining our time value
|
||||
Common::Timer m_timer;
|
||||
PostProcessingConfiguration m_config;
|
||||
|
||||
PostProcessingShaderConfiguration m_config;
|
||||
std::unique_ptr<AbstractShader> m_vertex_shader;
|
||||
std::unique_ptr<AbstractShader> m_pixel_shader;
|
||||
std::unique_ptr<AbstractPipeline> m_pipeline;
|
||||
AbstractTextureFormat m_framebuffer_format = AbstractTextureFormat::Undefined;
|
||||
std::vector<u8> m_uniform_staging_buffer;
|
||||
};
|
||||
} // namespace VideoCommon
|
||||
|
Reference in New Issue
Block a user