diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index ab5d83e..d2f4a58 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -1272,6 +1272,49 @@ void LLVOAvatar::resetImpostors() | |||
1272 | // static | 1272 | // static |
1273 | void LLVOAvatar::deleteCachedImages(bool clearAll) | 1273 | void LLVOAvatar::deleteCachedImages(bool clearAll) |
1274 | { | 1274 | { |
1275 | if(gAuditTexture) | ||
1276 | { | ||
1277 | S32 total_tex_size = sScratchTexBytes ; | ||
1278 | S32 tex_size = SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT ; | ||
1279 | |||
1280 | if( LLVOAvatar::sScratchTexNames.checkData( GL_LUMINANCE ) ) | ||
1281 | { | ||
1282 | LLImageGL::decTextureCounterStatic(tex_size, 1, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1283 | total_tex_size -= tex_size ; | ||
1284 | } | ||
1285 | if( LLVOAvatar::sScratchTexNames.checkData( GL_ALPHA ) ) | ||
1286 | { | ||
1287 | LLImageGL::decTextureCounterStatic(tex_size, 1, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1288 | total_tex_size -= tex_size ; | ||
1289 | } | ||
1290 | if( LLVOAvatar::sScratchTexNames.checkData( GL_COLOR_INDEX ) ) | ||
1291 | { | ||
1292 | LLImageGL::decTextureCounterStatic(tex_size, 1, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1293 | total_tex_size -= tex_size ; | ||
1294 | } | ||
1295 | if( LLVOAvatar::sScratchTexNames.checkData( GL_LUMINANCE_ALPHA ) ) | ||
1296 | { | ||
1297 | LLImageGL::decTextureCounterStatic(tex_size, 2, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1298 | total_tex_size -= 2 * tex_size ; | ||
1299 | } | ||
1300 | if( LLVOAvatar::sScratchTexNames.checkData( GL_RGB ) ) | ||
1301 | { | ||
1302 | LLImageGL::decTextureCounterStatic(tex_size, 3, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1303 | total_tex_size -= 3 * tex_size ; | ||
1304 | } | ||
1305 | if( LLVOAvatar::sScratchTexNames.checkData( GL_RGBA ) ) | ||
1306 | { | ||
1307 | LLImageGL::decTextureCounterStatic(tex_size, 4, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1308 | total_tex_size -= 4 * tex_size ; | ||
1309 | } | ||
1310 | //others | ||
1311 | while(total_tex_size > 0) | ||
1312 | { | ||
1313 | LLImageGL::decTextureCounterStatic(tex_size, 4, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
1314 | total_tex_size -= 4 * tex_size ; | ||
1315 | } | ||
1316 | } | ||
1317 | |||
1275 | if (LLTexLayerSet::sHasCaches) | 1318 | if (LLTexLayerSet::sHasCaches) |
1276 | { | 1319 | { |
1277 | lldebugs << "Deleting layer set caches" << llendl; | 1320 | lldebugs << "Deleting layer set caches" << llendl; |
@@ -4701,7 +4744,7 @@ U32 LLVOAvatar::renderFootShadows() | |||
4701 | LLGLDepthTest test(GL_TRUE, GL_FALSE); | 4744 | LLGLDepthTest test(GL_TRUE, GL_FALSE); |
4702 | //render foot shadows | 4745 | //render foot shadows |
4703 | LLGLEnable blend(GL_BLEND); | 4746 | LLGLEnable blend(GL_BLEND); |
4704 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); | 4747 | gGL.getTexUnit(0)->bind(mShadowImagep.get(), TRUE); |
4705 | glColor4fv(mShadow0Facep->getRenderColor().mV); | 4748 | glColor4fv(mShadow0Facep->getRenderColor().mV); |
4706 | mShadow0Facep->renderIndexed(foot_mask); | 4749 | mShadow0Facep->renderIndexed(foot_mask); |
4707 | glColor4fv(mShadow1Facep->getRenderColor().mV); | 4750 | glColor4fv(mShadow1Facep->getRenderColor().mV); |
@@ -4749,7 +4792,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4749 | //------------------------------------------------------------------------ | 4792 | //------------------------------------------------------------------------ |
4750 | // LLVOAvatar::updateTextures() | 4793 | // LLVOAvatar::updateTextures() |
4751 | //------------------------------------------------------------------------ | 4794 | //------------------------------------------------------------------------ |
4752 | void LLVOAvatar::updateTextures(LLAgent &agent) | 4795 | void LLVOAvatar::updateTextures() |
4753 | { | 4796 | { |
4754 | BOOL render_avatar = TRUE; | 4797 | BOOL render_avatar = TRUE; |
4755 | 4798 | ||
@@ -4816,9 +4859,9 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4816 | if (imagep) | 4859 | if (imagep) |
4817 | { | 4860 | { |
4818 | // Debugging code - maybe non-self avatars are downloading textures? | 4861 | // Debugging code - maybe non-self avatars are downloading textures? |
4819 | //llinfos << "avatar self " << mIsSelf << " tex " << i | 4862 | //llinfos << "avatar self " << mIsSelf << " tex " << index |
4820 | // << " decode " << imagep->getDecodePriority() | 4863 | // << " decode " << imagep->getDecodePriority() |
4821 | // << " boost " << boost_avatar | 4864 | // << " boost " << imagep->getBoostLevel() |
4822 | // << " size " << imagep->getWidth() << "x" << imagep->getHeight() | 4865 | // << " size " << imagep->getWidth() << "x" << imagep->getHeight() |
4823 | // << " discard " << imagep->getDiscardLevel() | 4866 | // << " discard " << imagep->getDiscardLevel() |
4824 | // << " desired " << imagep->getDesiredDiscardLevel() | 4867 | // << " desired " << imagep->getDesiredDiscardLevel() |
@@ -4826,7 +4869,7 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4826 | 4869 | ||
4827 | const LLTextureEntry *te = getTE(index); | 4870 | const LLTextureEntry *te = getTE(index); |
4828 | F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); | 4871 | F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); |
4829 | S32 boost_level = mIsSelf ? LLViewerImage::BOOST_AVATAR_BAKED_SELF : LLViewerImage::BOOST_AVATAR_BAKED; | 4872 | S32 boost_level = mIsSelf ? LLViewerImageBoostLevel::BOOST_AVATAR_BAKED_SELF : LLViewerImageBoostLevel::BOOST_AVATAR_BAKED; |
4830 | 4873 | ||
4831 | // Spam if this is a baked texture, not set to default image, without valid host info | 4874 | // Spam if this is a baked texture, not set to default image, without valid host info |
4832 | if (isIndexBakedTexture((ETextureIndex)index) | 4875 | if (isIndexBakedTexture((ETextureIndex)index) |
@@ -4849,6 +4892,12 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4849 | if (texture_dict->mIsLocalTexture) | 4892 | if (texture_dict->mIsLocalTexture) |
4850 | { | 4893 | { |
4851 | addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); | 4894 | addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); |
4895 | // SNOW-8 : temporary snowglobe1.0 fix for baked textures | ||
4896 | if (render_avatar && !gGLManager.mIsDisabled ) | ||
4897 | { | ||
4898 | // bind the texture so that its boost level won't be slammed | ||
4899 | gGL.getTexUnit(0)->bind(imagep); | ||
4900 | } | ||
4852 | } | 4901 | } |
4853 | else if (texture_dict->mIsBakedTexture) | 4902 | else if (texture_dict->mIsBakedTexture) |
4854 | { | 4903 | { |
@@ -4886,12 +4935,12 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, | |||
4886 | if( mIsSelf ) | 4935 | if( mIsSelf ) |
4887 | { | 4936 | { |
4888 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); | 4937 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); |
4889 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR_SELF); | 4938 | imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_AVATAR_SELF); |
4890 | } | 4939 | } |
4891 | else | 4940 | else |
4892 | { | 4941 | { |
4893 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_OTHER ); | 4942 | desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_OTHER ); |
4894 | imagep->setBoostLevel(LLViewerImage::BOOST_AVATAR); | 4943 | imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_AVATAR); |
4895 | } | 4944 | } |
4896 | imagep->addTextureStats( desired_pixels / texel_area_ratio ); | 4945 | imagep->addTextureStats( desired_pixels / texel_area_ratio ); |
4897 | if (imagep->getDiscardLevel() < 0) | 4946 | if (imagep->getDiscardLevel() < 0) |
@@ -7111,12 +7160,12 @@ BOOL LLVOAvatar::bindScratchTexture( LLGLenum format ) | |||
7111 | if( *last_bind_time != LLImageGL::sLastFrameTime ) | 7160 | if( *last_bind_time != LLImageGL::sLastFrameTime ) |
7112 | { | 7161 | { |
7113 | *last_bind_time = LLImageGL::sLastFrameTime; | 7162 | *last_bind_time = LLImageGL::sLastFrameTime; |
7114 | LLImageGL::updateBoundTexMem(texture_bytes); | 7163 | LLImageGL::updateBoundTexMemStatic(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; |
7115 | } | 7164 | } |
7116 | } | 7165 | } |
7117 | else | 7166 | else |
7118 | { | 7167 | { |
7119 | LLImageGL::updateBoundTexMem(texture_bytes); | 7168 | LLImageGL::updateBoundTexMemStatic(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; |
7120 | LLVOAvatar::sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); | 7169 | LLVOAvatar::sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); |
7121 | } | 7170 | } |
7122 | 7171 | ||
@@ -7138,7 +7187,8 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7138 | { | 7187 | { |
7139 | case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; | 7188 | case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; |
7140 | case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; | 7189 | case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; |
7141 | case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; | 7190 | // Support for GL_EXT_paletted_texture is deprecated |
7191 | // case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; | ||
7142 | case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; | 7192 | case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; |
7143 | case GL_RGB: components = 3; internal_format = GL_RGB8; break; | 7193 | case GL_RGB: components = 3; internal_format = GL_RGB8; break; |
7144 | case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; | 7194 | case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; |
@@ -7180,6 +7230,12 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7180 | 7230 | ||
7181 | LLVOAvatar::sScratchTexBytes += *texture_bytes; | 7231 | LLVOAvatar::sScratchTexBytes += *texture_bytes; |
7182 | LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; | 7232 | LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; |
7233 | |||
7234 | if(gAuditTexture) | ||
7235 | { | ||
7236 | LLImageGL::incTextureCounterStatic(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | ||
7237 | } | ||
7238 | |||
7183 | return name; | 7239 | return name; |
7184 | } | 7240 | } |
7185 | } | 7241 | } |
@@ -7495,7 +7551,8 @@ void LLVOAvatar::clearChat() | |||
7495 | 7551 | ||
7496 | S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) | 7552 | S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) |
7497 | { | 7553 | { |
7498 | if (!isIndexLocalTexture(index)) return FALSE; | 7554 | // If the texture is not local, we don't care and treat it as fully loaded |
7555 | if (!isIndexLocalTexture(index)) return 0; | ||
7499 | 7556 | ||
7500 | LocalTextureData &local_tex_data = mLocalTextureData[index]; | 7557 | LocalTextureData &local_tex_data = mLocalTextureData[index]; |
7501 | if (index >= 0 | 7558 | if (index >= 0 |