Skip to content
Snippets Groups Projects
Commit 47bd3d61 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix crash during shutdown

parent 5f255dbb
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -366,31 +366,33 @@ void LLRenderTarget::release() ...@@ -366,31 +366,33 @@ void LLRenderTarget::release()
glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO);
} }
// Detach any extra color buffers (e.g. SRGB spec buffers) if (mFBO)
// {
if (mFBO && (mTex.size() > 1)) // Detach any extra color buffers (e.g. SRGB spec buffers)
{ //
glBindFramebuffer(GL_FRAMEBUFFER, mFBO); if (mTex.size() > 1)
S32 z; {
for (z = mTex.size() - 1; z >= 1; z--) glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
{ S32 z;
sBytesAllocated -= mResX*mResY*4; for (z = mTex.size() - 1; z >= 1; z--)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+z, LLTexUnit::getInternalType(mUsage), 0, 0); {
LLImageGL::deleteTextures(1, &mTex[z]); sBytesAllocated -= mResX * mResY * 4;
} glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + z, LLTexUnit::getInternalType(mUsage), 0, 0);
glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO); LLImageGL::deleteTextures(1, &mTex[z]);
} }
glBindFramebuffer(GL_FRAMEBUFFER, sCurFBO);
if (mFBO == sCurFBO) }
{
sCurFBO = 0; if (mFBO == sCurFBO)
glBindFramebuffer(GL_FRAMEBUFFER, 0); {
} sCurFBO = 0;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
if (mFBO) }
{
glDeleteFramebuffers(1, (GLuint *) &mFBO); {
mFBO = 0; glDeleteFramebuffers(1, (GLuint*)&mFBO);
mFBO = 0;
}
} }
if (mTex.size() > 0) if (mTex.size() > 0)
......
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