diff options
author | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2015-12-01 19:57:38 +0200 |
---|---|---|
committer | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2015-12-01 19:57:38 +0200 |
commit | cbdf791fb1634c3c42c1e24da4b99dfdc3251f26 (patch) | |
tree | 67e2c49f5f91bda5dc2b182fcb9b5e0ebff33c7d | |
parent | f388e31ae4f644e2df07a5555687ea695b5784a2 (diff) |
MAINT-1109 Toggling graphics options causes viewer memory to increase, eventually causing the rendering pipeline to fall over and crashing the viewer
Te reason of memory leak - unloaded shaders.
Fixed.
-rwxr-xr-x | indra/llrender/llglslshader.cpp | 18 | ||||
-rwxr-xr-x | indra/llrender/llglslshader.h | 4 |
2 files changed, 16 insertions, 6 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 0f260674ed..52b8de8365 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -325,14 +325,20 @@ LLGLSLShader::~LLGLSLShader() void LLGLSLShader::unload() { + mShaderFiles.clear(); + mDefines.clear(); + + unloadInternal(); +} + +void LLGLSLShader::unloadInternal() +{ sInstances.erase(this); stop_glerror(); mAttribute.clear(); mTexture.clear(); mUniform.clear(); - mShaderFiles.clear(); - mDefines.clear(); if (mProgramObject) { @@ -354,13 +360,13 @@ void LLGLSLShader::unload() mProgramObject = 0; } - + if (mTimerQuery) { glDeleteQueriesARB(1, &mTimerQuery); mTimerQuery = 0; } - + if (mSamplesQuery) { glDeleteQueriesARB(1, &mSamplesQuery); @@ -369,7 +375,7 @@ void LLGLSLShader::unload() //hack to make apple not complain glGetError(); - + stop_glerror(); } @@ -378,6 +384,8 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, U32 varying_count, const char** varyings) { + unloadInternal(); + sInstances.insert(this); //reloading, reset matrix hash values diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 5abddf274b..0746e8760a 100755 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -198,7 +198,9 @@ public: bool mTextureStateFetched; std::vector<U32> mTextureMagFilter; std::vector<U32> mTextureMinFilter; - + +private: + void unloadInternal(); }; //UI shader (declared here so llui_libtest will link properly) |