Got to love that my server's cmake is half retarded.

This commit is contained in:
Ryan Houdek 2013-01-28 15:32:38 -06:00
parent d94f3c4155
commit fa45403557
2 changed files with 16 additions and 6 deletions

View File

@ -32,16 +32,23 @@ float *ProgramShaderCache::s_ubo_buffer;
u32 ProgramShaderCache::s_ubo_buffer_size; u32 ProgramShaderCache::s_ubo_buffer_size;
bool ProgramShaderCache::s_ubo_dirty; bool ProgramShaderCache::s_ubo_dirty;
LinearDiskCache<ProgramShaderCache::ShaderUID, u8> g_program_disk_cache; LinearDiskCache<u64, u8> g_program_disk_cache;
GLenum ProgramFormat; GLenum ProgramFormat;
GLuint ProgramShaderCache::PCacheEntry::prog_format = 0; GLuint ProgramShaderCache::PCacheEntry::prog_format = 0;
u64 ProgramShaderCache::CurrentShaderProgram; u64 ProgramShaderCache::CurrentShaderProgram;
u64 Create_Pair(u32 key1, u32 key2) u64 Create_Pair(u32 key1, u32 key2)
{ {
return (((u64)key1) << 32) | 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] = const char *UniformNames[NUM_UNIFORMS] =
{ {
// PIXEL SHADER UNIFORMS // PIXEL SHADER UNIFORMS

View File

@ -36,6 +36,7 @@ namespace OGL
const int NUM_UNIFORMS = 19; const int NUM_UNIFORMS = 19;
extern const char *UniformNames[NUM_UNIFORMS]; extern const char *UniformNames[NUM_UNIFORMS];
u64 Create_Pair(u32 key1, u32 key2); u64 Create_Pair(u32 key1, u32 key2);
void Get_Pair(u64 key, u32 *key1, u32 *key2);
class ProgramShaderCache class ProgramShaderCache
{ {
@ -48,7 +49,7 @@ public:
u8 *binary; u8 *binary;
GLint binary_size; GLint binary_size;
GLuint vsid, psid; GLuint vsid, psid;
ShaderUID uid; u64 uid;
GLint UniformLocations[NUM_UNIFORMS]; GLint UniformLocations[NUM_UNIFORMS];
PCacheEntry() : prog_id(0), binary(NULL), binary_size(0), vsid(0), psid(0) { } PCacheEntry() : prog_id(0), binary(NULL), binary_size(0), vsid(0), psid(0) { }
@ -126,15 +127,17 @@ public:
static void Shutdown(void); static void Shutdown(void);
private: private:
class ProgramShaderCacheInserter : public LinearDiskCacheReader<ShaderUID, u8> class ProgramShaderCacheInserter : public LinearDiskCacheReader<u64, u8>
{ {
public: 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 // The two shaders might not even exist anymore
// But it is fine, no need to worry about that // But it is fine, no need to worry about that
PCacheEntry entry; 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); glProgramBinary(entry.prog_id, entry.prog_format, value, value_size);
@ -154,7 +157,7 @@ private:
static PCache pshaders; static PCache pshaders;
static GLuint CurrentProgram; static GLuint CurrentProgram;
static ShaderUID CurrentShaderProgram; static u64 CurrentShaderProgram;
static GLuint s_ps_vs_ubo; static GLuint s_ps_vs_ubo;
static u32 s_ubo_iterator; static u32 s_ubo_iterator;