diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2016-06-24 10:43:46 +0200 |
| commit | 3570c7f03a2aa90aa634f96c0af1969af610f14d (patch) | |
| tree | 4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/VideoBackends/OGL/ProgramShaderCache.h | |
| parent | 2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff) | |
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/VideoBackends/OGL/ProgramShaderCache.h')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/ProgramShaderCache.h | 128 |
1 files changed, 60 insertions, 68 deletions
diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h index 234ac678c9..4852d71b86 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.h +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.h @@ -6,8 +6,8 @@ #include <tuple> -#include "Common/LinearDiskCache.h" #include "Common/GL/GLUtil.h" +#include "Common/LinearDiskCache.h" #include "Core/ConfigManager.h" @@ -17,91 +17,83 @@ namespace OGL { - class SHADERUID { public: - VertexShaderUid vuid; - PixelShaderUid puid; - GeometryShaderUid guid; - - bool operator <(const SHADERUID& r) const - { - return std::tie(puid, vuid, guid) < - std::tie(r.puid, r.vuid, r.guid); - } - - bool operator ==(const SHADERUID& r) const - { - return std::tie(puid, vuid, guid) == - std::tie(r.puid, r.vuid, r.guid); - } + VertexShaderUid vuid; + PixelShaderUid puid; + GeometryShaderUid guid; + + bool operator<(const SHADERUID& r) const + { + return std::tie(puid, vuid, guid) < std::tie(r.puid, r.vuid, r.guid); + } + + bool operator==(const SHADERUID& r) const + { + return std::tie(puid, vuid, guid) == std::tie(r.puid, r.vuid, r.guid); + } }; - struct SHADER { - SHADER() : glprogid(0) { } - void Destroy() - { - glDeleteProgram(glprogid); - glprogid = 0; - } - GLuint glprogid; // OpenGL program id - - std::string strvprog, strpprog, strgprog; - - void SetProgramVariables(); - void SetProgramBindings(); - void Bind(); + SHADER() : glprogid(0) {} + void Destroy() + { + glDeleteProgram(glprogid); + glprogid = 0; + } + GLuint glprogid; // OpenGL program id + + std::string strvprog, strpprog, strgprog; + + void SetProgramVariables(); + void SetProgramBindings(); + void Bind(); }; class ProgramShaderCache { public: + struct PCacheEntry + { + SHADER shader; + bool in_cache; - struct PCacheEntry - { - SHADER shader; - bool in_cache; - - void Destroy() - { - shader.Destroy(); - } - }; - + void Destroy() { shader.Destroy(); } + }; - static PCacheEntry GetShaderProgram(); - static SHADER* SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_type); - static void GetShaderId(SHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 primitive_type); + static PCacheEntry GetShaderProgram(); + static SHADER* SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_type); + static void GetShaderId(SHADERUID* uid, DSTALPHA_MODE dstAlphaMode, u32 primitive_type); - static bool CompileShader(SHADER &shader, const std::string& vcode, const std::string& pcode, const std::string& gcode = ""); - static GLuint CompileSingleShader(GLuint type, const std::string& code); - static void UploadConstants(); + static bool CompileShader(SHADER& shader, const std::string& vcode, const std::string& pcode, + const std::string& gcode = ""); + static GLuint CompileSingleShader(GLuint type, const std::string& code); + static void UploadConstants(); - static void Init(); - static void Shutdown(); - static void CreateHeader(); + static void Init(); + static void Shutdown(); + static void CreateHeader(); private: - class ProgramShaderCacheInserter : public LinearDiskCacheReader<SHADERUID, u8> - { - public: - void Read(const SHADERUID &key, const u8 *value, u32 value_size) override; - }; - - typedef std::map<SHADERUID, PCacheEntry> PCache; - static PCache pshaders; - static PCacheEntry* last_entry; - static SHADERUID last_uid; - - static UidChecker<PixelShaderUid, ShaderCode> pixel_uid_checker; - static UidChecker<VertexShaderUid, ShaderCode> vertex_uid_checker; - static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker; - - static u32 s_ubo_buffer_size; - static s32 s_ubo_align; + class ProgramShaderCacheInserter : public LinearDiskCacheReader<SHADERUID, u8> + { + public: + void Read(const SHADERUID& key, const u8* value, u32 value_size) override; + }; + + typedef std::map<SHADERUID, PCacheEntry> PCache; + static PCache pshaders; + static PCacheEntry* last_entry; + static SHADERUID last_uid; + + static UidChecker<PixelShaderUid, ShaderCode> pixel_uid_checker; + static UidChecker<VertexShaderUid, ShaderCode> vertex_uid_checker; + static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker; + + static u32 s_ubo_buffer_size; + static s32 s_ubo_align; }; } // namespace OGL |
