diff options
Diffstat (limited to 'indra/llrender/llshadermgr.h')
-rw-r--r-- | indra/llrender/llshadermgr.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index ec3455952b..4a2241a9d6 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -295,7 +295,7 @@ public: void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text); BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE); BOOL validateProgramObject(GLuint obj); - GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); + GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual @@ -303,6 +303,13 @@ public: // Implemented in the application to actually update out of date uniforms for a particular shader virtual void updateShaderUniforms(LLGLSLShader * shader) = 0; // Pure Virtual + void initShaderCache(bool enabled, const LLUUID& old_cache_version, const LLUUID& current_cache_version); + void clearShaderCache(); + void persistShaderCacheMetadata(); + + bool loadCachedProgramBinary(LLGLSLShader* shader); + bool saveCachedProgramBinary(LLGLSLShader* shader); + public: // Map of shader names to compiled std::map<std::string, GLuint> mVertexShaderObjects; @@ -313,8 +320,16 @@ public: std::vector<std::string> mReservedUniforms; - //preprocessor definitions (name/value) - std::map<std::string, std::string> mDefinitions; + struct ProgramBinaryData + { + GLsizei mBinaryLength = 0; + GLenum mBinaryFormat = 0; + F32 mLastUsedTime = 0.0; + }; + std::map<LLUUID, ProgramBinaryData> mShaderBinaryCache; + bool mShaderCacheInitialized = false; + bool mShaderCacheEnabled = false; + std::string mShaderCacheDir; protected: |