diff options
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r-- | indra/llrender/llimagegl.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 249b8da880..38764eba23 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 @@ -742,12 +748,16 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) S32 height = getHeight(mCurrentDiscardLevel); S32 nummips = mMaxDiscardLevel - mCurrentDiscardLevel + 1; S32 w = width, h = height; + + + const U8* new_data = 0; + (void)new_data; + const U8* prev_mip_data = 0; const U8* cur_mip_data = 0; #ifdef SHOW_ASSERT S32 cur_mip_size = 0; #endif - mMipLevels = nummips; for (int m=0; m<nummips; m++) @@ -767,14 +777,22 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) llassert(cur_mip_size == bytes*4); #endif U8* new_data = new U8[bytes]; + +#ifdef SHOW_ASSERT + llassert(prev_mip_data); + llassert(cur_mip_size == bytes*4); llassert_always(new_data); +#endif + LLImageBase::generateMip(prev_mip_data, new_data, w, h, mComponents); cur_mip_data = new_data; #ifdef SHOW_ASSERT cur_mip_size = bytes; #endif + } llassert(w > 0 && h > 0 && cur_mip_data); + (void)cur_mip_data; { // LLFastTimer t1(FTM_TEMP4); if(mFormatSwapBytes) @@ -1098,7 +1116,21 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip { if (gGLManager.mInited) { - if (format == 0 || type == LLTexUnit::TT_CUBE_MAP || mip_levels == -1) + switch (format) + { + 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; + + 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); } @@ -1106,11 +1138,13 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip { 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]); - - glTexImage2D(LLTexUnit::getInternalType(type), j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + 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(), @@ -1121,6 +1155,9 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip } } } + break; + } + } /*if (immediate) { |