diff options
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r-- | indra/llrender/llimagegl.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5c171d372c..b3c718253b 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -624,7 +624,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { is_compressed = true; } - + if (mUseMipMaps) @@ -752,6 +752,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) const U8* cur_mip_data = 0; #ifdef SHOW_ASSERT S32 cur_mip_size = 0; + S32 prev_mip_size = 0; #endif mMipLevels = nummips; @@ -770,17 +771,18 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) S32 bytes = w * h * mComponents; #ifdef SHOW_ASSERT llassert(prev_mip_data); - llassert(cur_mip_size == bytes*4); -#endif + llassert(prev_mip_size == bytes*4); U8* new_data = new U8[bytes]; 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 + } +#ifdef SHOW_ASSERT llassert(w > 0 && h > 0 && cur_mip_data); +#endif { // LLFastTimer t1(FTM_TEMP4); if(mFormatSwapBytes) @@ -811,6 +813,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) delete[] prev_mip_data; } prev_mip_data = cur_mip_data; + prev_mip_size = cur_mip_size; w >>= 1; h >>= 1; } @@ -1119,30 +1122,30 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip 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 + { //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]); + 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; } } |