Skip to content
Snippets Groups Projects
Commit cbdf791f authored by ruslantproductengine's avatar ruslantproductengine
Browse files

MAINT-1109 Toggling graphics options causes viewer memory to increase,...

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.
parent f388e31a
No related branches found
No related tags found
No related merge requests found
......@@ -324,6 +324,14 @@ LLGLSLShader::~LLGLSLShader()
}
void LLGLSLShader::unload()
{
mShaderFiles.clear();
mDefines.clear();
unloadInternal();
}
void LLGLSLShader::unloadInternal()
{
sInstances.erase(this);
......@@ -331,8 +339,6 @@ void LLGLSLShader::unload()
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
......
......@@ -198,7 +198,9 @@ class LLGLSLShader
bool mTextureStateFetched;
std::vector<U32> mTextureMagFilter;
std::vector<U32> mTextureMinFilter;
private:
void unloadInternal();
};
//UI shader (declared here so llui_libtest will link properly)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment