summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2016-08-02 21:57:04 +0300
committerandreykproductengine <akleshchev@productengine.com>2016-08-02 21:57:04 +0300
commit57060fa0ebfacf3705ec2d9770e83aab3c86b894 (patch)
tree86c5df1c366f42e3f00604317516ffb975af9c59 /indra/newview/llvoavatar.cpp
parentb37641ef8227426ca8ef8fdfc9b333793e79e111 (diff)
MAINT-4124 Warning user about render-heavy set of HUDs
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp65
1 files changed, 60 insertions, 5 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index cdc7e20c2c..aebc066507 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -186,6 +186,7 @@ const F32 NAMETAG_VERTICAL_SCREEN_OFFSET = 25.f;
const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f;
const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0;
+const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024;
enum ERenderName
{
@@ -8356,6 +8357,7 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
{
U32 cost = VISUAL_COMPLEXITY_UNKNOWN;
LLVOVolume::texture_cost_t textures;
+ LLHUDComplexity hud_complexity;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
@@ -8432,6 +8434,55 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
}
}
}
+ if (isSelf()
+ && attached_object
+ && attached_object->isHUDAttachment()
+ && attached_object->mDrawable)
+ {
+ textures.clear();
+
+ const LLVOVolume* volume = attached_object->mDrawable->getVOVolume();
+ if (volume)
+ {
+ // get cost and individual textures
+ hud_complexity.objectsCost += volume->getRenderCost(textures);
+ hud_complexity.objectsCount++;
+
+ LLViewerObject::const_child_list_t& child_list = attached_object->getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end(); ++iter)
+ {
+ LLViewerObject* childp = *iter;
+ const LLVOVolume* chld_volume = dynamic_cast<LLVOVolume*>(childp);
+ if (chld_volume)
+ {
+ // get cost and individual textures
+ hud_complexity.objectsCost += chld_volume->getRenderCost(textures);
+ hud_complexity.objectsCount++;
+ }
+ }
+
+ hud_complexity.texturesCount += textures.size();
+
+ for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin();
+ volume_texture != textures.end();
+ ++volume_texture)
+ {
+ // add the cost of each individual texture (ignores duplicates)
+ hud_complexity.texturesCost += volume_texture->second;
+ LLViewerFetchedTexture *tex = LLViewerTextureManager::getFetchedTexture(volume_texture->first);
+ if (tex)
+ {
+ F64 size = tex->getMaxVirtualSize(); // in pixels
+ hud_complexity.texturesSizeTotal += size;
+ if (size >= HUD_OVERSIZED_TEXTURE_DATA_SIZE)
+ {
+ hud_complexity.largeTexturesCount++;
+ }
+ }
+ }
+ }
+ }
}
}
@@ -8493,11 +8544,15 @@ void LLVOAvatar::calculateUpdateRenderComplexity()
static LLCachedControl<U32> show_my_complexity_changes(gSavedSettings, "ShowMyComplexityChanges", 20);
- if (isSelf() && show_my_complexity_changes)
- {
- LLAvatarRenderNotifier::getInstance()->updateNotificationAgent(mVisualComplexity);
- }
- }
+ if (isSelf() && show_my_complexity_changes)
+ {
+ // Avatar complexity
+ LLAvatarRenderNotifier::getInstance()->updateNotificationAgent(mVisualComplexity);
+
+ // HUD complexity
+ LLHUDRenderNotifier::getInstance()->updateNotificationHUD(hud_complexity);
+ }
+ }
}
void LLVOAvatar::setVisualMuteSettings(VisualMuteSettings set)