diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-05-22 10:42:18 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-05-22 10:42:18 -0700 |
commit | b273edd1253e088ea864d399342a0cba2fd0aaa9 (patch) | |
tree | 317ff7c05eacccb80b3fe06d65d8f64d7ff6019d /indra/llrender/llshadermgr.h | |
parent | da72081582c3fd376e228cf0fceaef2ecb1948a9 (diff) | |
parent | c6fc951f34c665d0f1cd6dcff1bea114fb0ff1a0 (diff) |
Merge branch 'DRTVWR-559' into DRTVWR-583
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 3da7a2a5f3..8c19c80cb0 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -302,7 +302,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 @@ -310,6 +310,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; @@ -320,8 +327,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: |