diff options
author | simon <none@none> | 2013-05-09 14:10:45 -0700 |
---|---|---|
committer | simon <none@none> | 2013-05-09 14:10:45 -0700 |
commit | ee2fce8790b69d61845cc32fbf7cdce8a33b0dab (patch) | |
tree | 5060f42dca293102c868038f127c1a74f5c4a6aa /indra/llrender/llimagegl.cpp | |
parent | cd8e0b92e1c8f9f8544b1011e61c21c7789b93b7 (diff) | |
parent | 8895e795763d14c3dae495b3648da3d4a52ba30a (diff) |
Merge downstream code and viewer-beta
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rwxr-xr-x | indra/llrender/llimagegl.cpp | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 28b7830b0e..5aef2c972e 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -736,10 +736,11 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) stop_glerror(); } - if (gGLManager.mHasFramebufferObject) + if (LLRender::sGLCoreProfile) { glGenerateMipmap(mTarget); - } + } + stop_glerror(); } } else @@ -1116,37 +1117,46 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip { if (gGLManager.mInited) { - if (LLRender::sGLCoreProfile) + switch (format) { - switch (format) - { - case GL_LUMINANCE8: format = GL_RGB8; break; - case GL_LUMINANCE8_ALPHA8: - case GL_ALPHA8: format = GL_RGBA8; break; - } - } + case 0: - 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 - { - 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]); + // 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 - llassert(std::find(sDeadTextureList[type][format].begin(), - sDeadTextureList[type][format].end(), textures[i]) == - sDeadTextureList[type][format].end()); + 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()); - sDeadTextureList[type][format].push_back(textures[i]); - } + sDeadTextureList[type][format].push_back(textures[i]); + } + } + } + break; } } |