summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2012-05-22 00:49:07 -0500
committerDave Parks <davep@lindenlab.com>2012-05-22 00:49:07 -0500
commit534168c452c10b1616b883e63321edd1ccd96fb2 (patch)
treea61818a9f38b1e4467a8dc3434f725192495a73b
parentb9606f57c32dc021fd967a40aebc1d2a44bea0bd (diff)
MAINT-616 Fix for crash on shutdown caused by previous changes.
-rw-r--r--indra/llrender/llimagegl.cpp35
-rw-r--r--indra/llrender/llvertexbuffer.cpp15
2 files changed, 28 insertions, 22 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 3bdee6cade..2d3762135a 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1113,24 +1113,27 @@ void LLImageGL::generateTextures(LLTexUnit::eTextureType type, S32 numTextures,
// static
void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, S32 numTextures, U32 *textures, bool immediate)
{
- for (S32 i = 0; i < numTextures; ++i)
- { //remove texture from VRAM by setting its size to zero
- gGL.getTexUnit(0)->bindManual(type, textures[i]);
+ if (gGLManager.mInited)
+ {
+ for (S32 i = 0; i < numTextures; ++i)
+ { //remove texture from VRAM by setting its size to zero
+ gGL.getTexUnit(0)->bindManual(type, textures[i]);
- if (type == LLTexUnit::TT_CUBE_MAP)
- {
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- }
- else
- {
- glTexImage2D(LLTexUnit::getInternalType(type), 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ if (type == LLTexUnit::TT_CUBE_MAP)
+ {
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ else
+ {
+ glTexImage2D(LLTexUnit::getInternalType(type), 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ }
+ sDeadTextureList[type].push_back(textures[i]);
}
- sDeadTextureList[type].push_back(textures[i]);
}
/*if (immediate)
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 6a218e7734..0e037fdd21 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -142,16 +142,19 @@ U32 LLVBOPool::genBuffer()
void LLVBOPool::deleteBuffer(U32 name)
{
- LLVertexBuffer::unbind();
+ if (gGLManager.mInited)
+ {
+ LLVertexBuffer::unbind();
- glBindBufferARB(mType, name);
- glBufferDataARB(mType, 0, NULL, mUsage);
+ glBindBufferARB(mType, name);
+ glBufferDataARB(mType, 0, NULL, mUsage);
- llassert(std::find(mGLNamePool.begin(), mGLNamePool.end(), name) == mGLNamePool.end());
+ llassert(std::find(mGLNamePool.begin(), mGLNamePool.end(), name) == mGLNamePool.end());
- mGLNamePool.push_back(name);
+ mGLNamePool.push_back(name);
- LLVertexBuffer::unbind();
+ LLVertexBuffer::unbind();
+ }
}