diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llgl.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 57 |
2 files changed, 42 insertions, 17 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 9e4857b6bc..09e451c62a 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -86,7 +86,7 @@ void APIENTRY gl_debug_callback(GLenum source, } else { - llwarns << "----- GL WARNING -------" << llendl; + llwarns << "----- GL WARNING -------" << llendl; } llwarns << "Type: " << std::hex << type << llendl; llwarns << "ID: " << std::hex << id << llendl; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index a4d7872ec2..552dac518a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -726,6 +726,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 @@ -1084,27 +1090,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; } } |