From 0858ba2d0a7253e7f9f4db84560da6f829f7270c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Nov 2014 12:37:46 -0500 Subject: clean up showing avatar draw costs --- indra/newview/llvoavatar.cpp | 77 +++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 26 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 22b979aa09..d5d93e82a8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3089,9 +3089,6 @@ bool LLVOAvatar::isVisuallyMuted() if (!isSelf()) { - static LLCachedControl render_auto_mute_functions(gSavedSettings, "RenderAutoMuteFunctions", 0); - if (render_auto_mute_functions) // Hacky debug switch for developing feature - { // Priority order (highest priority first) // * own avatar is never visually muted // * if on the "always draw normally" list, draw them normally @@ -3124,7 +3121,7 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - U32 max_cost = (U32) (max_render_cost*(LLVOAvatar::sLODFactor+0.5)); + U32 max_cost = (U32) (max_render_cost); muted = LLMuteList::getInstance()->isMuted(getID()) || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || @@ -3140,8 +3137,7 @@ bool LLVOAvatar::isVisuallyMuted() } // Always draw friends or those in IMs. Needs UI? - if ((render_auto_mute_functions & 0x02) && - (muted || sMaxVisible == 0)) // Don't mute friends or IMs + if (muted || sMaxVisible == 0) // Don't mute friends or IMs { muted = !(LLAvatarTracker::instance().isBuddy(getID())); if (muted) @@ -3158,7 +3154,6 @@ bool LLVOAvatar::isVisuallyMuted() mCachedVisualMute = muted; } } - } } return muted; @@ -7956,28 +7951,58 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d void LLVOAvatar::idleUpdateRenderCost() { - static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - static const U32 ARC_LIMIT = 20000; + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) + { + std::string render_info_text; + F32 worst_ratio = 0.f; + F32 red_level, green_level; + + static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); + render_info_text.append(llformat("%.1f KB%s", mAttachmentGeometryBytes/1024.f, + (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) ? "!" : "")); - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES)) - { //set debug text to attachment geometry bytes here so render cost will override - setDebugText(llformat("%.1f KB, %.2f m^2", mAttachmentGeometryBytes/1024.f, mAttachmentSurfaceArea)); - } + if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this + { + if ((mAttachmentGeometryBytes/(F32)max_attachment_bytes) > worst_ratio) + { + worst_ratio = mAttachmentGeometryBytes/(F32)max_attachment_bytes; + green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); + red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); + } + } + + static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); + render_info_text.append(llformat(" %.2f m^2%s", mAttachmentSurfaceArea, + (max_attachment_area > 0 && mAttachmentSurfaceArea > max_attachment_area) ? "!" : "")); - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME) && max_render_cost == 0) - { - return; - } + if (max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this + { + if ((mAttachmentSurfaceArea/max_attachment_area) > worst_ratio) + { + worst_ratio = mAttachmentSurfaceArea/max_attachment_area; + green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); + red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); + } + } - calculateUpdateRenderCost(); // Update mVisualComplexity if needed - - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) - { - std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus()); - setDebugText(llformat("%s %d", viz_string.c_str(), mVisualComplexity)); - F32 green = 1.f-llclamp(((F32) mVisualComplexity-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); - F32 red = llmin((F32) mVisualComplexity/(F32)ARC_LIMIT, 1.f); - mText->setColor(LLColor4(red,green,0,1)); + calculateUpdateRenderCost(); // Update mVisualComplexity if needed + + static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); + render_info_text.append(llformat(" %d%s", mVisualComplexity, + (max_render_cost > 0 && mVisualComplexity > max_render_cost) ? "!" : "")); + + if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this + { + if (((F32)mVisualComplexity/(F32)max_render_cost) > worst_ratio) + { + worst_ratio = (F32)mVisualComplexity/(F32)max_render_cost; + green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); + red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); + } + } + + setDebugText(render_info_text); + mText->setColor(worst_ratio != 0.f ? LLColor4(red_level,green_level,0,1) : LLColor4::green); } } -- cgit v1.3 From 48a27b4a965c447bbb75a995688ba8838256e3f6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Nov 2014 13:26:34 -0500 Subject: fix warning for gcc that clang did not care about --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d5d93e82a8..e0128463f3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7955,7 +7955,8 @@ void LLVOAvatar::idleUpdateRenderCost() { std::string render_info_text; F32 worst_ratio = 0.f; - F32 red_level, green_level; + F32 red_level = 0.f; + F32 green_level = 0.f; static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); render_info_text.append(llformat("%.1f KB%s", mAttachmentGeometryBytes/1024.f, -- cgit v1.3 From c71cf9cf23ff7a9928695367e9b62db3bed38ed7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 1 Dec 2014 13:45:48 -0500 Subject: Improve display of avatar rendering info, remove last use of RenderAutoMuteFunctions --- indra/newview/app_settings/settings.xml | 11 ---- indra/newview/llavatarrenderinfoaccountant.cpp | 29 --------- indra/newview/llviewerobject.cpp | 17 +++-- indra/newview/llviewerobject.h | 1 + indra/newview/llvoavatar.cpp | 87 +++++++++++++++++--------- 5 files changed, 68 insertions(+), 77 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 17b43901a9..31890ca205 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9911,17 +9911,6 @@ Value 0 - RenderAutoMuteFunctions - - Comment - Developing feature to render some avatars using simple impostors or colored silhouettes. (Set to 7 for all functionality) - Persist - 1 - Type - U32 - Value - 0 - RenderAutoMuteLogging Comment diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 38e153137c..ca2674bf94 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -335,35 +335,6 @@ void LLAvatarRenderInfoAccountant::idle() // We scanned all the regions, reset the request timer. sRenderInfoReportTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); } - - static LLCachedControl render_auto_mute_functions(gSavedSettings, "RenderAutoMuteFunctions", 0); - static U32 prev_render_auto_mute_functions = (U32) -1; - if (prev_render_auto_mute_functions != render_auto_mute_functions) - { - prev_render_auto_mute_functions = render_auto_mute_functions; - - // Adjust menus - BOOL show_items = (BOOL)(render_auto_mute_functions & 0x04); - gMenuAvatarOther->setItemVisible( std::string("Normal"), show_items); - gMenuAvatarOther->setItemVisible( std::string("Always use impostor"), show_items); - gMenuAvatarOther->setItemVisible( std::string("Never use impostor"), show_items); - gMenuAvatarOther->setItemVisible( std::string("Impostor seperator"), show_items); - - gMenuAttachmentOther->setItemVisible( std::string("Normal"), show_items); - gMenuAttachmentOther->setItemVisible( std::string("Always use impostor"), show_items); - gMenuAttachmentOther->setItemVisible( std::string("Never use impostor"), show_items); - gMenuAttachmentOther->setItemVisible( std::string("Impostor seperator"), show_items); - - if (!show_items) - { // Turning off visual muting - for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) - { // Make sure all AVs have the setting cleared - LLVOAvatar* inst = (LLVOAvatar*) *iter; - inst->setCachedVisualMute(false); - } - } - } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 4f992fc184..2f6283c8d0 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4926,12 +4926,7 @@ void LLViewerObject::setDebugText(const std::string &utf8text) if (!mText) { - mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); - mText->setFont(LLFontGL::getFontSansSerif()); - mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP); - mText->setMaxLines(-1); - mText->setSourceObject(this); - mText->setOnHUDAttachment(isHUDAttachment()); + initDebugTextHud(); } mText->setColor(LLColor4::white); mText->setString(utf8text); @@ -4940,6 +4935,16 @@ void LLViewerObject::setDebugText(const std::string &utf8text) updateText(); } +void LLViewerObject::initDebugTextHud() +{ + mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); + mText->setFont(LLFontGL::getFontSansSerif()); + mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP); + mText->setMaxLines(-1); + mText->setSourceObject(this); + mText->setOnHUDAttachment(isHUDAttachment()); +} + void LLViewerObject::setIcon(LLViewerTexture* icon_image) { if (!mIcon) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index bab107cc57..e7ae0af32a 100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -398,6 +398,7 @@ public: void setCanSelect(BOOL canSelect); + void initDebugTextHud(); void setDebugText(const std::string &utf8text); void setIcon(LLViewerTexture* icon_image); void clearIcon(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e0128463f3..3a83943209 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7953,57 +7953,82 @@ void LLVOAvatar::idleUpdateRenderCost() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) { - std::string render_info_text; - F32 worst_ratio = 0.f; - F32 red_level = 0.f; - F32 green_level = 0.f; + std::string info_line; + F32 red_level; + F32 green_level; + LLColor4 info_color; + LLFontGL::StyleFlags info_style; + + if ( !mText ) + { + initDebugTextHud(); + } + else + { + mText->clearString(); // clear debug text + } static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); - render_info_text.append(llformat("%.1f KB%s", mAttachmentGeometryBytes/1024.f, - (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) ? "!" : "")); - + info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this { - if ((mAttachmentGeometryBytes/(F32)max_attachment_bytes) > worst_ratio) - { - worst_ratio = mAttachmentGeometryBytes/(F32)max_attachment_bytes; - green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); - red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); - } + green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); + red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( mAttachmentGeometryBytes > max_attachment_bytes + ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } + else + { + info_color.setToWhite(); + info_style = LLFontGL::NORMAL; } + LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; + mText->addLine(info_line, info_color); static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); - render_info_text.append(llformat(" %.2f m^2%s", mAttachmentSurfaceArea, - (max_attachment_area > 0 && mAttachmentSurfaceArea > max_attachment_area) ? "!" : "")); + info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); if (max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this { - if ((mAttachmentSurfaceArea/max_attachment_area) > worst_ratio) - { - worst_ratio = mAttachmentSurfaceArea/max_attachment_area; - green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); - red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); - } + green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); + red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( max_attachment_area > mAttachmentSurfaceArea + ? LLFontGL::BOLD : LLFontGL::NORMAL ); + + } + else + { + info_color.setToWhite(); + info_style = LLFontGL::NORMAL; } + LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; + mText->addLine(info_line, info_color, info_style); calculateUpdateRenderCost(); // Update mVisualComplexity if needed static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - render_info_text.append(llformat(" %d%s", mVisualComplexity, - (max_render_cost > 0 && mVisualComplexity > max_render_cost) ? "!" : "")); + info_line = llformat("%d arc", mVisualComplexity); if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { - if (((F32)mVisualComplexity/(F32)max_render_cost) > worst_ratio) - { - worst_ratio = (F32)mVisualComplexity/(F32)max_render_cost; - green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); - red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); - } + green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); + red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( mVisualComplexity > max_render_cost + ? LLFontGL::BOLD : LLFontGL::NORMAL ); + + } + else + { + info_color.setToWhite(); + info_style = LLFontGL::NORMAL; } + LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; + mText->addLine(info_line, info_color, info_style); - setDebugText(render_info_text); - mText->setColor(worst_ratio != 0.f ? LLColor4(red_level,green_level,0,1) : LLColor4::green); + updateText(); // corrects position } } -- cgit v1.3 From 9785a88ba447087fb547794430f24d7513909cbe Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 3 Dec 2014 10:13:50 -0500 Subject: further improvements to avatar render info display and logging of associated server messages --- indra/newview/llavatarrenderinfoaccountant.cpp | 119 +++++++++++-------------- indra/newview/llavatarrenderinfoaccountant.h | 2 - indra/newview/llvoavatar.cpp | 54 +++++------ 3 files changed, 81 insertions(+), 94 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index ca2674bf94..83ae0438d9 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -70,14 +70,14 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - LL_WARNS() << "HTTP error result for avatar weight GET: " << statusNum + LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight GET: " << statusNum << ", " << reason << " returned by region " << regionp->getName() << LL_ENDL; } else { - LL_WARNS() << "Avatar render weight GET error recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight GET error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason @@ -91,10 +91,7 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights request for region '" << regionp->getName() << "':" << LL_ENDL; if (content.isMap()) { @@ -109,40 +106,57 @@ public: LLUUID target_agent_id = LLUUID(report_iter->first); const LLSD & agent_info_map = report_iter->second; LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); - if (avatarp && - avatarp->isAvatar() && - agent_info_map.isMap()) + if ( avatarp + && avatarp->isAvatar() + && agent_info_map.isMap()) { // Extract the data for this avatar - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; if (agent_info_map.has(KEY_WEIGHT)) { ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); } } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: agent entry invalid" + << " agent " << target_agent_id + << " map " << agent_info_map + << LL_ENDL; + } report_iter++; } } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response agents content is not map" << LL_ENDL; + } + } // has "agents" else if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - LL_WARNS() << "Avatar render info GET error: " + LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() << LL_ENDL; } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: no agent key in get response" << LL_ENDL; + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response is not map" << LL_ENDL; } } else { - LL_INFOS() << "Avatar render weight info recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight info recieved but region not found for " << mRegionHandle << LL_ENDL; } } @@ -165,14 +179,14 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - LL_WARNS() << "HTTP error result for avatar weight POST: " << statusNum + LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight POST: " << statusNum << ", " << reason << " returned by region " << regionp->getName() << LL_ENDL; } else { - LL_WARNS() << "Avatar render weight POST error recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight POST error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason @@ -185,18 +199,15 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights POST for region " << regionp->getName() + << ": " << content << LL_ENDL; if (content.isMap()) { if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - LL_WARNS() << "Avatar render info POST error: " + LL_WARNS("AvatarRenderInfo") << "Avatar render info POST error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() @@ -206,7 +217,7 @@ public: } else { - LL_INFOS() << "Avatar render weight POST result recieved but region not found for " + LL_INFOS("AvatarRenderInfo") << "Avatar render weight POST result recieved but region not found for " << mRegionHandle << LL_ENDL; } } @@ -223,13 +234,10 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio std::string url = regionp->getCapability("AvatarRenderInfo"); if (!url.empty()) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Sending avatar render info to region " - << regionp->getName() - << " from " << url - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Checking for avatar render info to send to region " + << regionp->getName() + << " from " << url + << LL_ENDL; // Build the render info to POST to the region LLSD report = LLSD::emptyMap(); @@ -252,14 +260,8 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio info[KEY_WEIGHT] = avatar->getVisualComplexity(); agents[avatar->getID().asString()] = info; - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; - LL_INFOS() << "LRI: other info geometry " << avatar->getAttachmentGeometryBytes() - << ", area " << avatar->getAttachmentSurfaceArea() - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; } } iter++; @@ -268,6 +270,9 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio report[KEY_AGENTS] = agents; if (agents.size() > 0) { + LL_INFOS("AvatarRenderInfo") << "LRI: Sending info for " << agents.size() + << " avatars to region " << regionp->getName() + << LL_ENDL; LLHTTPClient::post(url, report, new LLAvatarRenderInfoPostResponder(regionp->getHandle())); } } @@ -283,13 +288,10 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi std::string url = regionp->getCapability("AvatarRenderInfo"); if (!url.empty()) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Requesting avatar render info for region " - << regionp->getName() - << " from " << url - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Requesting avatar render info for region " + << regionp->getName() + << " from " << url + << LL_ENDL; // First send a request to get the latest data LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); @@ -308,11 +310,8 @@ void LLAvatarRenderInfoAccountant::idle() S32 num_avs = LLCharacter::sInstances.size(); - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Scanning all regions and checking for render info updates" - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Scanning all regions and checking for render info updates" + << LL_ENDL; // Check all regions and see if it's time to fetch/send data for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); @@ -344,12 +343,9 @@ void LLAvatarRenderInfoAccountant::idle() // are returned for a new LLViewerRegion, and is the earliest time to get render info void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& region_id) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Viewer has new region capabilities, clearing global render info timer" - << " and timer for region " << region_id - << LL_ENDL; - } + LL_INFOS("AvatarRenderInfo") << "LRI: Viewer has new region capabilities, clearing global render info timer" + << " and timer for region " << region_id + << LL_ENDL; // Reset the global timer so it will scan regions immediately sRenderInfoReportTimer.reset(); @@ -360,10 +356,3 @@ void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& reg regionp->getRenderInfoRequestTimer().reset(); } } - -// static -bool LLAvatarRenderInfoAccountant::logRenderInfo() -{ - static LLCachedControl render_mute_logging_enabled(gSavedSettings, "RenderAutoMuteLogging", false); - return render_mute_logging_enabled; -} diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h index d68f2dccfb..62c899f7a4 100644 --- a/indra/newview/llavatarrenderinfoaccountant.h +++ b/indra/newview/llavatarrenderinfoaccountant.h @@ -46,8 +46,6 @@ public: static void idle(); - static bool logRenderInfo(); - private: // Send data updates about once per minute, only need per-frame resolution static LLFrameTimer sRenderInfoReportTimer; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3a83943209..816b2c8b67 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7948,7 +7948,6 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d angle.mV[2] = da; } - void LLVOAvatar::idleUpdateRenderCost() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) @@ -7962,30 +7961,35 @@ void LLVOAvatar::idleUpdateRenderCost() if ( !mText ) { initDebugTextHud(); + mText->setFadeDistance(15.0, 5.0); // limit clutter in large crowds } else { mText->clearString(); // clear debug text } - static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); - info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); - if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this + calculateUpdateRenderCost(); // Update mVisualComplexity if needed + + static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); + info_line = llformat("%d arc", mVisualComplexity); + + if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { - green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); - red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); + green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); + red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( mAttachmentGeometryBytes > max_attachment_bytes + info_style = ( mVisualComplexity > max_render_cost ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; - mText->addLine(info_line, info_color); - + LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; + mText->addLine(info_line, info_color, info_style); + static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); @@ -7994,40 +7998,36 @@ void LLVOAvatar::idleUpdateRenderCost() green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( max_attachment_area > mAttachmentSurfaceArea + info_style = ( mAttachmentSurfaceArea > max_attachment_area ? LLFontGL::BOLD : LLFontGL::NORMAL ); } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); - calculateUpdateRenderCost(); // Update mVisualComplexity if needed - - static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d arc", mVisualComplexity); - - if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this + static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); + info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); + if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this { - green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); - red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); + green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); + red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( mVisualComplexity > max_render_cost + info_style = ( mAttachmentGeometryBytes > max_attachment_bytes ? LLFontGL::BOLD : LLFontGL::NORMAL ); - } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; - mText->addLine(info_line, info_color, info_style); - + LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; + mText->addLine(info_line, info_color); + updateText(); // corrects position } } -- cgit v1.3 From fe627f64742cbec698df0a907cb8aaea297df599 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 15 Dec 2014 15:59:49 -0500 Subject: MAINT-4716: correct reading of and debug display for avatar render cost info --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llavatarrenderinfoaccountant.cpp | 470 ++++++++++++++----------- indra/newview/llavatarrenderinfoaccountant.h | 33 +- indra/newview/llviewerregion.cpp | 3 +- indra/newview/llviewerregion.h | 6 +- indra/newview/llvoavatar.cpp | 59 +++- 6 files changed, 337 insertions(+), 236 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a5008507a..4ad8181055 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5090,7 +5090,7 @@ void LLAppViewer::idle() } // Update AV render info - LLAvatarRenderInfoAccountant::idle(); + LLAvatarRenderInfoAccountant::getInstance()->idle(); { LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 83ae0438d9..8631f245a9 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -28,14 +28,16 @@ // Precompiled header #include "llviewerprecompiledheaders.h" -// associated header -#include "llavatarrenderinfoaccountant.h" // STL headers // std headers // external library headers // other Linden headers #include "llcharacter.h" -#include "llhttpclient.h" +#include "httprequest.h" +#include "httphandler.h" +#include "httpresponse.h" +#include "llcorehttputil.h" +#include "llappcorehttp.h" #include "lltimer.h" #include "llviewercontrol.h" #include "llviewermenu.h" @@ -43,6 +45,8 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llworld.h" +// associated header +#include "llavatarrenderinfoaccountant.h" static const std::string KEY_AGENTS = "agents"; // map @@ -53,228 +57,259 @@ static const std::string KEY_MESSAGE = "message"; static const std::string KEY_ERROR = "error"; -// Send data updates about once per minute, only need per-frame resolution -LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer; +static const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds +static const F32 SECS_BETWEEN_REGION_REQUEST = 15.0; // Look for new avs every 15 seconds +static const F32 SECS_BETWEEN_REGION_REPORTS = 60.0; // Update each region every 60 seconds + + +// The policy class for HTTP traffic; this is the right value for all capability requests. +static LLCore::HttpRequest::policy_t http_policy(LLAppCoreHttp::AP_REPORTING); + +// Priority for HTTP requests. Use 0U. +static LLCore::HttpRequest::priority_t http_priority(0U); +LLAvatarRenderInfoAccountant::LLAvatarRenderInfoAccountant() + : mHttpRequest(new LLCore::HttpRequest) + , mHttpHeaders(new LLCore::HttpHeaders) + , mHttpOptions(new LLCore::HttpOptions) +{ + mHttpOptions->setTransferTimeout(SECS_BETWEEN_REGION_SCANS); + + mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); + mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); +} + +LLAvatarRenderInfoAccountant::~LLAvatarRenderInfoAccountant() +{ + mHttpOptions->release(); + mHttpHeaders->release(); + // delete mHttpRequest; ??? +} // HTTP responder class for GET request for avatar render weight information -class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoGetHandler : public LLCore::HttpHandler { +private: + LOG_CLASS(LLAvatarRenderInfoGetHandler); + public: - LLAvatarRenderInfoGetResponder(U64 region_handle) : mRegionHandle(region_handle) + LLAvatarRenderInfoGetHandler() : LLCore::HttpHandler() { } - virtual void error(U32 statusNum, const std::string& reason) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight GET: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight GET error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } - - } - - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights request for region '" << regionp->getName() << "':" << LL_ENDL; - - if (content.isMap()) - { - if (content.has(KEY_AGENTS)) + LLCore::HttpStatus status = response->getStatus(); + if (status) + { + LLSD avatar_render_info; + if (LLCoreHttpUtil::responseToLLSD(response, false /* quiet logging */, + avatar_render_info)) { - const LLSD & agents = content[KEY_AGENTS]; - if (agents.isMap()) + if (avatar_render_info.isMap()) { - LLSD::map_const_iterator report_iter = agents.beginMap(); - while (report_iter != agents.endMap()) + if (avatar_render_info.has(KEY_AGENTS)) { - LLUUID target_agent_id = LLUUID(report_iter->first); - const LLSD & agent_info_map = report_iter->second; - LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); - if ( avatarp - && avatarp->isAvatar() - && agent_info_map.isMap()) - { // Extract the data for this avatar - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << LL_ENDL; - - if (agent_info_map.has(KEY_WEIGHT)) + const LLSD & agents = avatar_render_info[KEY_AGENTS]; + if (agents.isMap()) + { + for (LLSD::map_const_iterator agent_iter = agents.beginMap(); + agent_iter != agents.endMap(); + agent_iter++ + ) { - ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); - } + LLUUID target_agent_id = LLUUID(agent_iter->first); + LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); + if (avatarp && avatarp->isAvatar()) + { + const LLSD & agent_info_map = agent_iter->second; + if (agent_info_map.isMap()) + { + LL_DEBUGS("AvatarRenderInfo") << " Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; + + if (agent_info_map.has(KEY_WEIGHT)) + { + ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "agent entry invalid" + << " agent " << target_agent_id + << " map " << agent_info_map + << LL_ENDL; + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "Unknown agent " << target_agent_id << LL_ENDL; + } + } // for agent_iter } else { - LL_WARNS("AvatarRenderInfo") << "LRI: agent entry invalid" - << " agent " << target_agent_id - << " map " << agent_info_map - << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response agents avatar_render_info is not map" << LL_ENDL; } - report_iter++; + } // has "agents" + else if (avatar_render_info.has(KEY_ERROR)) + { + const LLSD & error = avatar_render_info[KEY_ERROR]; + LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " + << error[KEY_IDENTIFIER] + << ": " << error[KEY_MESSAGE] + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "no agent key in get response" << LL_ENDL; } } else { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response agents content is not map" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response is not map" << LL_ENDL; } - - } // has "agents" - else if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + } else { - LL_WARNS("AvatarRenderInfo") << "LRI: no agent key in get response" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response parse failure" << LL_ENDL; } - } - else - { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response is not map" << LL_ENDL; - } - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight info recieved but region not found for " - << mRegionHandle << LL_ENDL; + } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "GET failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - } - -private: - U64 mRegionHandle; }; // HTTP responder class for POST request for avatar render weight information -class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoPostHandler : public LLCore::HttpHandler { -public: - LLAvatarRenderInfoPostResponder(U64 region_handle) : mRegionHandle(region_handle) - { - } + private: + LOG_CLASS(LLAvatarRenderInfoPostHandler); - virtual void error(U32 statusNum, const std::string& reason) + public: + LLAvatarRenderInfoPostHandler() : LLCore::HttpHandler() { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight POST: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight POST error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } } - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << LL_ENDL; - - if (content.isMap()) + LLCore::HttpStatus status = response->getStatus(); + if (status) { - if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info POST error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "post succeeded" << LL_ENDL; } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "POST failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - else - { - LL_INFOS("AvatarRenderInfo") << "Avatar render weight POST result recieved but region not found for " - << mRegionHandle << LL_ENDL; - } - } - -private: - U64 mRegionHandle; }; -// static // Send request for one region, no timer checks +// called when the void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if ( regionp->getRenderInfoReportTimer().hasExpired() ) // Time to make request { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Checking for avatar render info to send to region " - << regionp->getName() - << " from " << url - << LL_ENDL; - - // Build the render info to POST to the region - LLSD report = LLSD::emptyMap(); - LLSD agents = LLSD::emptyMap(); - - std::vector::iterator iter = LLCharacter::sInstances.begin(); - while( iter != LLCharacter::sInstances.end() ) + U32 num_avs = 0; + + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) { - LLVOAvatar* avatar = dynamic_cast(*iter); - if (avatar && - avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) - !avatar->isDead() && // Not dead yet - avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region + // Build the render info to POST to the region + LLSD agents = LLSD::emptyMap(); + + std::vector::iterator iter = LLCharacter::sInstances.begin(); + while( iter != LLCharacter::sInstances.end() ) { - avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - - LLSD info = LLSD::emptyMap(); - if (avatar->getVisualComplexity() > 0) + LLVOAvatar* avatar = dynamic_cast(*iter); + if (avatar && + avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) + !avatar->isDead() && // Not dead yet + avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { - info[KEY_WEIGHT] = avatar->getVisualComplexity(); - agents[avatar->getID().asString()] = info; + avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - LL_DEBUGS("AvatarRenderInfo") << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; + LLSD info = LLSD::emptyMap(); + if (avatar->getVisualComplexity() > 0) + { + info[KEY_WEIGHT] = avatar->getVisualComplexity(); + agents[avatar->getID().asString()] = info; + + LL_DEBUGS("AvatarRenderInfo") << "Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; + num_avs++; + } } + iter++; } - iter++; - } - report[KEY_AGENTS] = agents; - if (agents.size() > 0) + if (num_avs > 0) + { + LLSD report = LLSD::emptyMap(); + report[KEY_AGENTS] = agents; + + LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); + LLAvatarRenderInfoPostHandler* handler = new LLAvatarRenderInfoPostHandler; + + handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, + http_policy, + http_priority, + url, + report, + mHttpOptions, + mHttpHeaders, + handler); + if (LLCORE_HTTP_HANDLE_INVALID == handle) + { + LLCore::HttpStatus status(mHttpRequest->getStatus()); + LL_WARNS("AvatarRenderInfo") << "HTTP POST request failed" + << " Status: " << status.toTerseString() + << " Reason: '" << status.toString() << "'" + << LL_ENDL; + delete handler; + } + else + { + LL_INFOS("AvatarRenderInfo") << "Sent render costs for " << num_avs + << " avatars to region " << regionp->getName() + << LL_ENDL; + + + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "no agent info to send" << LL_ENDL; + } + } + else { - LL_INFOS("AvatarRenderInfo") << "LRI: Sending info for " << agents.size() - << " avatars to region " << regionp->getName() - << LL_ENDL; - LLHTTPClient::post(url, report, new LLAvatarRenderInfoPostResponder(regionp->getHandle())); + LL_WARNS("AvatarRenderInfo") << "AvatarRenderInfo cap is empty" << LL_ENDL; } + + // Reset this regions timer, moving to longer intervals if there are lots of avatars around + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_REPORTS + (2.f * num_avs)); } } @@ -285,16 +320,39 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio // Send request for one region, no timer checks void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if (regionp->getRenderInfoRequestTimer().hasExpired()) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Requesting avatar render info for region " - << regionp->getName() - << " from " << url - << LL_ENDL; + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) + { + + LLAvatarRenderInfoGetHandler* handler = new LLAvatarRenderInfoGetHandler; + // First send a request to get the latest data + LLCore::HttpHandle handle = mHttpRequest->requestGet(http_policy, + http_priority, + url, + NULL, + NULL, + handler); + if (LLCORE_HTTP_HANDLE_INVALID != handle) + { + LL_INFOS("AvatarRenderInfo") << "Requested avatar render info for region " + << regionp->getName() + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "Failed to launch HTTP GET request. Try again." + << LL_ENDL; + delete handler; + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "no AvatarRenderInfo cap for " << regionp->getName() << LL_ENDL; + } - // First send a request to get the latest data - LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); + regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST); } } @@ -303,56 +361,60 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi // Called every frame - send render weight requests to every region void LLAvatarRenderInfoAccountant::idle() { - if (sRenderInfoReportTimer.hasExpired()) - { - const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds - const F32 SECS_BETWEEN_REGION_REQUEST = 60.0; // Update each region every 60 seconds + mHttpRequest->update(0); // give any pending http operations a chance to call completion methods - S32 num_avs = LLCharacter::sInstances.size(); - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Scanning all regions and checking for render info updates" + if (mRenderInfoScanTimer.hasExpired()) + { + LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates" << LL_ENDL; - // Check all regions and see if it's time to fetch/send data + // Check all regions for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + iter != LLWorld::getInstance()->getRegionList().end(); + ++iter) { LLViewerRegion* regionp = *iter; - if (regionp && - regionp->isAlive() && - regionp->capabilitiesReceived() && // Region has capability URLs available - regionp->getRenderInfoRequestTimer().hasExpired()) // Time to make request + if ( regionp + && regionp->isAlive() + && regionp->capabilitiesReceived()) { + // each of these is further governed by and resets its own timer sendRenderInfoToRegion(regionp); getRenderInfoFromRegion(regionp); - - // Reset this regions timer, moving to longer intervals if there are lots of avatars around - regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST + (2.f * num_avs)); } } // We scanned all the regions, reset the request timer. - sRenderInfoReportTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + mRenderInfoScanTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); } } +void LLAvatarRenderInfoAccountant::resetRenderInfoScanTimer() +{ + // this will force the next frame to rescan + mRenderInfoScanTimer.reset(); +} // static -// Make sRenderInfoReportTimer expire so the next call to idle() will scan and query a new region -// called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities +// Called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities // are returned for a new LLViewerRegion, and is the earliest time to get render info -void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& region_id) +void LLAvatarRenderInfoAccountant::scanNewRegion(const LLUUID& region_id) { - LL_INFOS("AvatarRenderInfo") << "LRI: Viewer has new region capabilities, clearing global render info timer" - << " and timer for region " << region_id - << LL_ENDL; + LL_INFOS("AvatarRenderInfo") << region_id << LL_ENDL; - // Reset the global timer so it will scan regions immediately - sRenderInfoReportTimer.reset(); + // Reset the global timer so it will scan regions on the next call to ::idle + LLAvatarRenderInfoAccountant::getInstance()->resetRenderInfoScanTimer(); LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp) - { // Reset the region's timer so it will request data immediately + { // Reset the region's timers so we will: + // * request render info from it immediately + // * report on the following scan regionp->getRenderInfoRequestTimer().reset(); + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + } + else + { + LL_WARNS("AvatarRenderInfo") << "unable to resolve region "< { -public: - LLAvatarRenderInfoAccountant() {}; - ~LLAvatarRenderInfoAccountant() {}; + private: + LOG_CLASS(LLAvatarRenderInfoAccountant); - static void sendRenderInfoToRegion(LLViewerRegion * regionp); - static void getRenderInfoFromRegion(LLViewerRegion * regionp); + public: + LLAvatarRenderInfoAccountant(); + ~LLAvatarRenderInfoAccountant(); - static void expireRenderInfoReportTimer(const LLUUID& region_id); + void sendRenderInfoToRegion(LLViewerRegion * regionp); + void getRenderInfoFromRegion(LLViewerRegion * regionp); - static void idle(); + void idle(); // called once per frame -private: - // Send data updates about once per minute, only need per-frame resolution - static LLFrameTimer sRenderInfoReportTimer; + void resetRenderInfoScanTimer(); + + static void scanNewRegion(const LLUUID& region_id); + + private: + // frequency of region scans, + // further limited by per region Request and Report timers + LLFrameTimer mRenderInfoScanTimer; + + // + LLCore::HttpRequest* mHttpRequest; + LLCore::HttpHeaders* mHttpHeaders; + LLCore::HttpOptions* mHttpOptions; }; #endif /* ! defined(LL_llavatarrenderinfoaccountant_H) */ diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 11cbf3fc24..31493ca6ce 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -475,8 +475,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE mImpl->mVOCachePartition = getVOCachePartition(); - mRenderInfoRequestTimer.resetWithExpiry(0.f); // Set timer to be expired - setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer, _1)); + setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::scanNewRegion, _1)); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 1e225553b8..fbe229e00f 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -431,7 +431,8 @@ public: static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; - LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoReportTimer() { return mRenderInfoReportTimer; }; struct CompareRegionByLastUpdate { @@ -536,7 +537,8 @@ private: // the materials capability throttle LLFrameTimer mMaterialsCapThrottleTimer; -LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoReportTimer; }; inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 816b2c8b67..7e9f098172 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3121,12 +3121,10 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - U32 max_cost = (U32) (max_render_cost); - muted = LLMuteList::getInstance()->isMuted(getID()) || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f) || - (mVisualComplexity > max_cost && max_render_cost > 0); + (mVisualComplexity > max_render_cost && max_render_cost > 0); // Could be part of the grand || collection above, but yanked out to make the logic visible if (!muted) @@ -7967,11 +7965,17 @@ void LLVOAvatar::idleUpdateRenderCost() { mText->clearString(); // clear debug text } - + + /* + * NOTE: the logic for whether or not each of the values below + * controls muting MUST match that in the isVisuallyMuted method. + */ + + // Render Cost (ARC) calculateUpdateRenderCost(); // Update mVisualComplexity if needed static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d arc", mVisualComplexity); + info_line = llformat("%d ARC", mVisualComplexity); if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { @@ -7980,16 +7984,37 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(red_level, green_level, 0.0, 1.0); info_style = ( mVisualComplexity > max_render_cost ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } + else + { + info_color.set(LLColor4::grey); + info_style = LLFontGL::NORMAL; + } + mText->addLine(info_line, info_color, info_style); + + // TEMPORARY Reported Cost + info_line = llformat("%d reported ARC", mReportedVisualComplexity); + mText->addLine(info_line, info_color /* same as real ARC */, LLFontGL::ITALIC); + + // Visual rank + info_line = llformat("%d rank", mVisibilityRank); + if (sMaxVisible != 0) // zero means no limit, so don't bother coloring based on this + { + green_level = 1.f-llclamp(((F32)sMaxVisible-(F32)mVisibilityRank)/(F32)sMaxVisible, 0.f, 1.f); + red_level = llmin((F32) mVisibilityRank/(F32)sMaxVisible, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( mVisibilityRank > sMaxVisible + ? LLFontGL::BOLD : LLFontGL::NORMAL ); } else { info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment Surface Area static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); @@ -8007,9 +8032,9 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment byte limit static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this @@ -8025,8 +8050,7 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; - mText->addLine(info_line, info_color); + mText->addLine(info_line, info_color, info_style); updateText(); // corrects position } @@ -8049,7 +8073,8 @@ void LLVOAvatar::calculateUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict + = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8061,11 +8086,11 @@ void LLVOAvatar::calculateUpdateRenderCost() } - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + for (attachment_map_t::const_iterator attachment_point = mAttachmentPoints.begin(); + attachment_point != mAttachmentPoints.end(); + ++attachment_point) { - LLViewerJointAttachment* attachment = iter->second; + LLViewerJointAttachment* attachment = attachment_point->second; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) @@ -8095,10 +8120,12 @@ void LLVOAvatar::calculateUpdateRenderCost() } } - for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter) + for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); + volume_texture != textures.end(); + ++volume_texture) { // add the cost of each individual texture in the linkset - cost += iter->second; + cost += volume_texture->second; } } } -- cgit v1.3 From 2731ea88ceddcbfc66b9b790325ad5ef9942bef4 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 26 Jan 2015 16:04:49 -0500 Subject: minor code cleanups, remove friend and conversation status as visual mute criteria --- indra/newview/llvoavatar.cpp | 93 ++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 59 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7e9f098172..efa5724389 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -980,10 +980,11 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; - if (!inst) - continue; - S32 rez_status = inst->getRezzedStatus(); - counts[rez_status]++; + if (inst) + { + S32 rez_status = inst->getRezzedStatus(); + counts[rez_status]++; + } } } @@ -1973,9 +1974,6 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, } } - //LL_INFOS() << getRotation() << LL_ENDL; - //LL_INFOS() << getPosition() << LL_ENDL; - return retval; } @@ -1991,7 +1989,7 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU result = gTextureList.findImage(uuid); } if (!result) -{ + { const std::string url = getImageURL(te,uuid); if (url.empty()) @@ -3087,17 +3085,16 @@ bool LLVOAvatar::isVisuallyMuted() { bool muted = false; + // Priority order (highest priority first) + // * own avatar is never visually muted + // * if on the "always draw normally" list, draw them normally + // * if on the "always visually mute" list, mute them + // * draw them normally if they meet the following criteria: + // - within the closest N avatars + // - AND aren't over the thresholds + // * otherwise visually mute all other avatars if (!isSelf()) { - // Priority order (highest priority first) - // * own avatar is never visually muted - // * if on the "always draw normally" list, draw them normally - // * if on the "always visually mute" list, mute them - // * draw them normally if they meet the following criteria: - // - within the closest N avatars OR on friends list OR in an IM chat - // - AND aren't over the thresholds - // * otherwise visually mute all other avatars - static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0.0); static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); @@ -3121,30 +3118,12 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - muted = LLMuteList::getInstance()->isMuted(getID()) || - (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || - (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f) || - (mVisualComplexity > max_render_cost && max_render_cost > 0); - - // Could be part of the grand || collection above, but yanked out to make the logic visible - if (!muted) - { - if (sMaxVisible > 0) - { // They are above the visibilty rank - mute them - muted = (mVisibilityRank > sMaxVisible); - } - - // Always draw friends or those in IMs. Needs UI? - if (muted || sMaxVisible == 0) // Don't mute friends or IMs - { - muted = !(LLAvatarTracker::instance().isBuddy(getID())); - if (muted) - { // Not a friend, so they are muted ... are they in an IM? - LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,getID()); - muted = !gIMMgr->hasSession(session_id); - } - } - } + muted = ( (sMaxVisible > 0 && mVisibilityRank > sMaxVisible) + || (max_render_cost > 0 && mVisualComplexity > max_render_cost) + || (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) + || (max_attachment_area > 0.f && mAttachmentSurfaceArea > max_attachment_area) + || LLMuteList::getInstance()->isMuted(getID()) + ); // Save visual mute state and set interval for updating const F64 SECONDS_BETWEEN_RENDER_AUTO_MUTE_UPDATES = 1.5; @@ -3328,7 +3307,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) removeAnimationData("Walk Speed"); } mMotionController.setTimeStep(time_step); -// LL_INFOS() << "Setting timestep to " << time_quantum * pixel_area_scale << LL_ENDL; + // LL_INFOS() << "Setting timestep to " << time_quantum * pixel_area_scale << LL_ENDL; } if (getParent() && !mIsSitting) @@ -3469,7 +3448,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) fwdDir.normalize(); } } - } LLQuaternion root_rotation = mRoot->getWorldMatrix().quaternion(); @@ -3585,10 +3563,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // update animations if (mSpecialRenderMode == 1) // Animation Preview + { updateMotions(LLCharacter::FORCE_UPDATE); + } else + { updateMotions(LLCharacter::NORMAL_UPDATE); - + } + // update head position updateHeadOffset(); @@ -3685,10 +3667,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) //mesh vertices need to be reskinned mNeedsSkin = TRUE; - - - - return TRUE; } //----------------------------------------------------------------------------- @@ -7992,10 +7970,6 @@ void LLVOAvatar::idleUpdateRenderCost() } mText->addLine(info_line, info_color, info_style); - // TEMPORARY Reported Cost - info_line = llformat("%d reported ARC", mReportedVisualComplexity); - mText->addLine(info_line, info_color /* same as real ARC */, LLFontGL::ITALIC); - // Visual rank info_line = llformat("%d rank", mVisibilityRank); @@ -8143,9 +8117,8 @@ void LLVOAvatar::calculateUpdateRenderCost() for (LLVOVolume::texture_cost_t::iterator it = textures.begin(); it != textures.end(); ++it) { LLUUID image_id = it->first; - if( image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR) - continue; - if (all_textures.find(image_id) == all_textures.end()) + if( ! (image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR) + && (all_textures.find(image_id) == all_textures.end())) { // attachment texture not previously seen. LL_INFOS() << "attachment_texture: " << image_id.asString() << LL_ENDL; @@ -8211,15 +8184,17 @@ LLColor4 LLVOAvatar::calcMutedAVColor(F32 value, S32 range_low, S32 range_high) // static BOOL LLVOAvatar::isIndexLocalTexture(ETextureIndex index) { - if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture; + return (index < 0 || index >= TEX_NUM_INDICES) + ? false + : LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsLocalTexture; } // static BOOL LLVOAvatar::isIndexBakedTexture(ETextureIndex index) { - if (index < 0 || index >= TEX_NUM_INDICES) return false; - return LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture; + return (index < 0 || index >= TEX_NUM_INDICES) + ? false + : LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mIsBakedTexture; } const std::string LLVOAvatar::getBakedStatusForPrintout() const -- cgit v1.3 From 75cf991e9ccb1d64fae7458e4012f7130c1db369 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 27 Jan 2015 15:05:19 -0500 Subject: don't use jellybaby rendering for impostors (visually muted != impostored) --- indra/newview/llvoavatar.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index efa5724389..b8bbde6a89 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3118,8 +3118,7 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - muted = ( (sMaxVisible > 0 && mVisibilityRank > sMaxVisible) - || (max_render_cost > 0 && mVisualComplexity > max_render_cost) + muted = ( (max_render_cost > 0 && mVisualComplexity > max_render_cost) || (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) || (max_attachment_area > 0.f && mAttachmentSurfaceArea > max_attachment_area) || LLMuteList::getInstance()->isMuted(getID()) @@ -7972,20 +7971,9 @@ void LLVOAvatar::idleUpdateRenderCost() // Visual rank info_line = llformat("%d rank", mVisibilityRank); - - if (sMaxVisible != 0) // zero means no limit, so don't bother coloring based on this - { - green_level = 1.f-llclamp(((F32)sMaxVisible-(F32)mVisibilityRank)/(F32)sMaxVisible, 0.f, 1.f); - red_level = llmin((F32) mVisibilityRank/(F32)sMaxVisible, 1.f); - info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( mVisibilityRank > sMaxVisible - ? LLFontGL::BOLD : LLFontGL::NORMAL ); - } - else - { - info_color.set(LLColor4::grey); - info_style = LLFontGL::NORMAL; - } + // Use grey for imposters, white for normal rendering or no impostors + info_color.set((sMaxVisible > 0 && mVisibilityRank > sMaxVisible) ? LLColor4::grey : LLColor4::white); + info_style = LLFontGL::NORMAL; mText->addLine(info_line, info_color, info_style); // Attachment Surface Area -- cgit v1.3 From 695004ab6648e5c018ff765a37dfdd34cfb61020 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 30 Jan 2015 17:31:10 -0500 Subject: tone down visually muted avatar colors --- indra/newview/llvoavatar.cpp | 21 ++++++++++----------- indra/newview/llvoavatar.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b8bbde6a89..532bb325ea 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -784,8 +784,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mCachedVisualMuteUpdateTime = LLFrameTimer::getTotalSeconds() + 5.0; mVisuallyMuteSetting = VISUAL_MUTE_NOT_SET; - F32 color_value = (F32) (getID().mData[0]); - mMutedAVColor = calcMutedAVColor(color_value, 0, 256); + mMutedAVColor = calcMutedAVColor(getID()); } std::string LLVOAvatar::avString() const @@ -8141,11 +8140,11 @@ void LLVOAvatar::calculateUpdateRenderCost() // static -LLColor4 LLVOAvatar::calcMutedAVColor(F32 value, S32 range_low, S32 range_high) +LLColor4 LLVOAvatar::calcMutedAVColor(const LLUUID av_id) { - F32 clamped_value = llmin(value, (F32) range_high); - clamped_value = llmax(value, (F32) range_low); - F32 spectrum = (clamped_value / range_high); // spectrum is between 0 and 1.f + // select a color based on the first byte of the agents uuid so any muted agent is always the same color + F32 color_value = (F32) (av_id.mData[0]); + F32 spectrum = (color_value / 256.0); // spectrum is between 0 and 1.f // Array of colors. These are arranged so only one RGB color changes between each step, // and it loops back to red so there is an even distribution. It is not a heat map @@ -8159,12 +8158,12 @@ LLColor4 LLVOAvatar::calcMutedAVColor(F32 value, S32 range_low, S32 range_high) LLColor4 new_color = lerp(*spectrum_color[spectrum_index_1], *spectrum_color[spectrum_index_2], fractBetween); new_color.normalize(); - new_color *= 0.7f; // Tone it down a bit + new_color *= 0.5f; // Tone it down - //LL_INFOS() << "From value " << std::setprecision(3) << value << " returning color " << new_color - // << " using indexes " << spectrum_index_1 << ", " << spectrum_index_2 - // << " and fractBetween " << fractBetween - // << LL_ENDL; + LL_DEBUGS("AvatarMute") << "avatar "<< av_id << " color " << std::setprecision(3) << color_value << " returning color " << new_color + << " using indexes " << spectrum_index_1 << ", " << spectrum_index_2 + << " and fractBetween " << fractBetween + << LL_ENDL; return new_color; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 42ff7bff92..f2c1b34905 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -315,7 +315,7 @@ public: static void logPendingPhasesAllAvatars(); void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed); - static LLColor4 calcMutedAVColor(F32 value, S32 range_low, S32 range_high); + static LLColor4 calcMutedAVColor(const LLUUID av_id); protected: LLViewerStats::PhaseMap& getPhases() { return mPhases; } -- cgit v1.3 From 71a38e3a76f472e652c9ca43d948e5a90ebbcff3 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 3 Feb 2015 07:04:22 -0800 Subject: remove unused RenderAvatarComplexityLimit; replace with visual muting based on render weight --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/llvoavatar.cpp | 24 ++++++------------------ indra/newview/llvoavatar.h | 1 - 3 files changed, 6 insertions(+), 30 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b78cb01d85..c2c93bbb80 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8202,17 +8202,6 @@ Value 1 - RenderAvatarComplexityLimit - - Comment - Max visual complexity of avatars in a scene - Persist - 1 - Type - S32 - Value - -1 - RenderComplexityColorMin Comment diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 532bb325ea..44fbceed14 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -780,7 +780,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this); } - mCachedVisualMute = !isSelf(); + mCachedVisualMute = !isSelf(); // default to muting everyone? hmmm.... mCachedVisualMuteUpdateTime = LLFrameTimer::getTotalSeconds() + 5.0; mVisuallyMuteSetting = VISUAL_MUTE_NOT_SET; @@ -2534,7 +2534,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - if (!isTooComplex()) // do not generate particles for overly-complex avatars + if (!isVisuallyMuted()) // if we are muting the avatar, don't render particles { setParticleSource(particle_parameters, getID()); } @@ -3088,10 +3088,7 @@ bool LLVOAvatar::isVisuallyMuted() // * own avatar is never visually muted // * if on the "always draw normally" list, draw them normally // * if on the "always visually mute" list, mute them - // * draw them normally if they meet the following criteria: - // - within the closest N avatars - // - AND aren't over the thresholds - // * otherwise visually mute all other avatars + // * check against the render cost and attachment limits if (!isSelf()) { static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); @@ -6052,8 +6049,9 @@ BOOL LLVOAvatar::getIsCloud() const return TRUE; } - if (isTooComplex()) + if (isVisuallyMuted()) { + // we can render the muted representation return TRUE; } return FALSE; @@ -6305,16 +6303,6 @@ BOOL LLVOAvatar::isFullyLoaded() const return (mRenderUnloadedAvatar || mFullyLoaded); } -bool LLVOAvatar::isTooComplex() const -{ - if (gSavedSettings.getS32("RenderAvatarComplexityLimit") > 0 && mVisualComplexity >= gSavedSettings.getS32("RenderAvatarComplexityLimit")) - { - return true; - } - - return false; -} - //----------------------------------------------------------------------------- // findMotion() @@ -7935,7 +7923,7 @@ void LLVOAvatar::idleUpdateRenderCost() if ( !mText ) { initDebugTextHud(); - mText->setFadeDistance(15.0, 5.0); // limit clutter in large crowds + mText->setFadeDistance(20.0, 5.0); // limit clutter in large crowds } else { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index f2c1b34905..2921a3a3f9 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -297,7 +297,6 @@ public: //-------------------------------------------------------------------- public: BOOL isFullyLoaded() const; - bool isTooComplex() const; bool visualParamWeightsAreDefault(); virtual BOOL getIsCloud() const; BOOL isFullyTextured() const; -- cgit v1.3 From 059b561dd2fbbc115d815a41d58b8bb76f603074 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 4 Feb 2015 05:31:13 -0800 Subject: allow visually muted results to be cached from const methods --- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatar.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 44fbceed14..cfe83cb0b6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3080,7 +3080,7 @@ void LLVOAvatar::slamPosition() mRoot->updateWorldMatrixChildren(); } -bool LLVOAvatar::isVisuallyMuted() +bool LLVOAvatar::isVisuallyMuted() const { bool muted = false; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2921a3a3f9..f0f8bbe21b 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -385,7 +385,7 @@ public: public: U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0); - bool isVisuallyMuted(); + bool isVisuallyMuted() const; void setCachedVisualMute(bool muted) { mCachedVisualMute = muted; }; void forceUpdateVisualMuteSettings(); @@ -422,8 +422,9 @@ private: S32 mUpdatePeriod; S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. - bool mCachedVisualMute; // cached return value for isVisuallyMuted() - F64 mCachedVisualMuteUpdateTime; // Time to update mCachedVisualMute + // the isVisuallyMuted method uses these mutable values to avoid recalculating too frequently + mutable bool mCachedVisualMute; // cached return value for isVisuallyMuted() + mutable F64 mCachedVisualMuteUpdateTime; // Time to update mCachedVisualMute VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV -- cgit v1.3