From fa454035571544fe58936c0c821ed8ccb5e6b72d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 28 Jan 2013 15:32:38 -0600 Subject: [PATCH] Got to love that my server's cmake is half retarded. --- .../Plugin_VideoOGL/Src/ProgramShaderCache.cpp | 9 ++++++++- .../Plugin_VideoOGL/Src/ProgramShaderCache.h | 13 ++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index e1763038ec..76bf1e7e81 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -32,16 +32,23 @@ float *ProgramShaderCache::s_ubo_buffer; u32 ProgramShaderCache::s_ubo_buffer_size; bool ProgramShaderCache::s_ubo_dirty; -LinearDiskCache g_program_disk_cache; +LinearDiskCache g_program_disk_cache; GLenum ProgramFormat; GLuint ProgramShaderCache::PCacheEntry::prog_format = 0; u64 ProgramShaderCache::CurrentShaderProgram; + u64 Create_Pair(u32 key1, u32 key2) { return (((u64)key1) << 32) | key2; } +void Get_Pair(u64 key, u32 *key1, u32 *key2) +{ + *key1 = (key & 0xFFFFFFFF00000000) >> 32; + *key2 = key & 0xFFFFFFFF; +} + const char *UniformNames[NUM_UNIFORMS] = { // PIXEL SHADER UNIFORMS diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h index 1f4fefdc6f..acde00db1e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h @@ -36,6 +36,7 @@ namespace OGL const int NUM_UNIFORMS = 19; extern const char *UniformNames[NUM_UNIFORMS]; u64 Create_Pair(u32 key1, u32 key2); +void Get_Pair(u64 key, u32 *key1, u32 *key2); class ProgramShaderCache { @@ -48,7 +49,7 @@ public: u8 *binary; GLint binary_size; GLuint vsid, psid; - ShaderUID uid; + u64 uid; GLint UniformLocations[NUM_UNIFORMS]; PCacheEntry() : prog_id(0), binary(NULL), binary_size(0), vsid(0), psid(0) { } @@ -126,15 +127,17 @@ public: static void Shutdown(void); private: - class ProgramShaderCacheInserter : public LinearDiskCacheReader + class ProgramShaderCacheInserter : public LinearDiskCacheReader { public: - void Read(const ShaderUID &key, const u8 *value, u32 value_size) + void Read(const u64 &key, const u8 *value, u32 value_size) { // The two shaders might not even exist anymore // But it is fine, no need to worry about that PCacheEntry entry; - entry.Create(key.first, key.second); + u32 key1, key2; + Get_Pair(key, &key1, &key2); + entry.Create(key1, key2); glProgramBinary(entry.prog_id, entry.prog_format, value, value_size); @@ -154,7 +157,7 @@ private: static PCache pshaders; static GLuint CurrentProgram; - static ShaderUID CurrentShaderProgram; + static u64 CurrentShaderProgram; static GLuint s_ps_vs_ubo; static u32 s_ubo_iterator;