Replace the shader uid system with a new one which quasi-automatically generates uids for shaders.

Currently used in the vertex shader only (had to fork lighting shaders for now).
This commit is contained in:
NeoBrainX
2013-01-28 21:05:29 +01:00
parent a8d4c78cec
commit ca0e292dd4
5 changed files with 464 additions and 294 deletions
@@ -40,7 +40,7 @@ class VertexShaderCache
struct VSCacheEntry
{
VERTEXSHADER shader;
VERTEXSHADERUIDSAFE safe_uid;
ShaderUid safe_uid;
VSCacheEntry() {}
void Destroy() {
// printf("Destroying vs %i\n", shader.glprogid);
@@ -49,12 +49,12 @@ class VertexShaderCache
}
};
typedef std::map<VERTEXSHADERUID, VSCacheEntry> VSCache;
typedef std::map<ShaderUid, VSCacheEntry> VSCache;
static VSCache vshaders;
static VSCacheEntry* last_entry;
static VERTEXSHADERUID last_uid;
static ShaderUid last_uid; // TODO: Use reference instead..
static GLuint CurrentShader;
static bool ShaderEnabled;