diff options
author | Merov Linden <merov@lindenlab.com> | 2013-05-22 14:21:49 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-05-22 14:21:49 -0700 |
commit | 1c740dfb516aa03ea07d37f12de8a98b94be9572 (patch) | |
tree | 89275e879c17603736bb1ab69392ed24aa1d4d57 /indra/llrender/llimagegl.cpp | |
parent | 53ed2e4ac67088dce27f4c391d3e980e2d63154b (diff) | |
parent | 0ebcb7e3fd1452d42b5ca48139f99a4fd632d235 (diff) |
Pull merge from viewer-release
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r-- | indra/llrender/llimagegl.cpp | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 249b8da880..5c171d372c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -732,6 +732,12 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); stop_glerror(); } + + if (LLRender::sGLCoreProfile) + { + glGenerateMipmap(mTarget); + } + stop_glerror(); } } else @@ -1098,27 +1104,46 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip { if (gGLManager.mInited) { - if (format == 0 || type == LLTexUnit::TT_CUBE_MAP || mip_levels == -1) - { //unknown internal format or unknown number of mip levels, not safe to reuse - glDeleteTextures(numTextures, textures); - } - else + switch (format) { - for (S32 i = 0; i < numTextures; ++i) - { //remove texture from VRAM by setting its size to zero - for (S32 j = 0; j <= mip_levels; j++) - { - gGL.getTexUnit(0)->bindManual(type, textures[i]); + case 0: + + // We get ARB errors in debug when attempting to use glTexImage2D with these deprecated pix formats + // + case GL_LUMINANCE8: + case GL_INTENSITY8: + case GL_ALPHA8: + glDeleteTextures(numTextures, textures); + break; - glTexImage2D(LLTexUnit::getInternalType(type), j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + default: + { + if (type == LLTexUnit::TT_CUBE_MAP || mip_levels == -1) + { //unknown internal format or unknown number of mip levels, not safe to reuse + glDeleteTextures(numTextures, textures); } + else + { + for (S32 i = 0; i < numTextures; ++i) + { //remove texture from VRAM by setting its size to zero + + for (S32 j = 0; j <= mip_levels; j++) + { + gGL.getTexUnit(0)->bindManual(type, textures[i]); + U32 internal_type = LLTexUnit::getInternalType(type); + glTexImage2D(internal_type, j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + stop_glerror(); + } - llassert(std::find(sDeadTextureList[type][format].begin(), - sDeadTextureList[type][format].end(), textures[i]) == - sDeadTextureList[type][format].end()); + llassert(std::find(sDeadTextureList[type][format].begin(), + sDeadTextureList[type][format].end(), textures[i]) == + sDeadTextureList[type][format].end()); - sDeadTextureList[type][format].push_back(textures[i]); - } + sDeadTextureList[type][format].push_back(textures[i]); + } + } + } + break; } } |