diff options
author | Dave Parks <davep@lindenlab.com> | 2021-11-20 18:49:19 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2021-11-20 18:49:19 +0000 |
commit | 28f9fb06a9f4cb9edccb2ff8132c7f6a9b27c060 (patch) | |
tree | e3096bac94279dded08731dcc4f042d81dc2bfac /indra/llrender | |
parent | 3171aaad9b1f2757f8b0d8cbb784a45a7bbebafa (diff) |
SL-16289 Rigged mesh rendering overhaul
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 13 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 8 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 5 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 2 |
5 files changed, 25 insertions, 5 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 08c9dd8769..2f1ce0eec9 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -970,6 +970,19 @@ void LLGLSLShader::bind() } } +void LLGLSLShader::bind(bool rigged) +{ + if (rigged) + { + llassert(mRiggedVariant); + mRiggedVariant->bind(); + } + else + { + bind(); + } +} + void LLGLSLShader::unbind() { LL_PROFILE_ZONE_SCOPED; diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 3b23cf1b28..6fdb789087 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -230,6 +230,8 @@ public: BOOL link(BOOL suppress_errors = FALSE); void bind(); + //helper to conditionally bind mRiggedVariant instead of this + void bind(bool rigged); void unbind(); // Unbinds any previously bound shader by explicitly binding no shader. @@ -267,7 +269,8 @@ public: LLShaderFeatures mFeatures; std::vector< std::pair< std::string, GLenum > > mShaderFiles; std::string mName; - boost::unordered_map<std::string, std::string> mDefines; + typedef std::unordered_map<std::string, std::string> defines_map_t; + defines_map_t mDefines; //statistcis for profiling shader performance U32 mTimerQuery; @@ -285,6 +288,9 @@ public: std::vector<U32> mTextureMagFilter; std::vector<U32> mTextureMinFilter; + // this pointer should be set to whichever shader represents this shader's rigged variant + LLGLSLShader* mRiggedVariant = nullptr; + private: void unloadInternal(); }; diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index aad04beea2..0c180ed50d 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1283,7 +1283,7 @@ void LLRender::syncLightState() void LLRender::syncMatrices() { - static const U32 name[] = + static const U32 name[] = { LLShaderMgr::MODELVIEW_MATRIX, LLShaderMgr::PROJECTION_MATRIX, diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index e8c6295930..a9a4314afa 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -165,6 +165,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) if (features->hasObjectSkinning) { + shader->mRiggedVariant = shader; if (!shader->attachVertexObject("avatar/objectSkinV.glsl")) { return FALSE; @@ -599,7 +600,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& } } -GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, boost::unordered_map<std::string, std::string>* defines, S32 texture_index_channels) +GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels) { // endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl) @@ -774,7 +775,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (defines) { - for (boost::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter) + for (std::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter) { std::string define = "#define " + iter->first + " " + iter->second + "\n"; extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str()); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 3908efd4ec..67c0d6ab10 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -264,7 +264,7 @@ public: void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text); BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, boost::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); + GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_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 |