From 9f2987d995e8a2273f723a387dd587c3dc988056 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 23 Mar 2011 16:01:12 -0400 Subject: second pass at render complexity debug display. --- indra/newview/app_settings/settings.xml | 73 ++++++++++++++++++++++++- indra/newview/llchathistory.cpp | 2 +- indra/newview/llspatialpartition.cpp | 96 +++++++++++++++++++++++++++++---- indra/newview/llviewermenu.cpp | 2 +- 4 files changed, 160 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 176211773f..bf2d8eda7f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7105,7 +7105,78 @@ RenderAvatarComplexityLimit Comment - Max visual complexity of avatars in a scens + Max visual complexity of avatars in a scene + Persist + 1 + Type + S32 + Value + -1 + + RenderComplexityColorMin + + Comment + Max visual complexity of avatars in a scene + Persist + 1 + Type + Color4 + Value + + 0.0 + 0.0 + 1.0 + 0.5 + + + RenderComplexityColorMid + + Comment + Max visual complexity of avatars in a scene + Persist + 1 + Type + Color4 + Value + + 0.0 + 1.0 + 0.0 + 0.5 + + + RenderComplexityColorMax + + Comment + Max visual complexity of avatars in a scene + Persist + 1 + Type + Color4 + Value + + 1.0 + 0.0 + 0.0 + 0.5 + + + RenderComplexityThreshold + + Comment + Only color objects higher than render threshold + Persist + 1 + Type + S32 + Value + -1 + + RenderComplexityStaticMax + + Comment + Sets a static max value for scaling of RenderComplexity + display (-1 for dynamic scaling) Persist 1 Type diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d4ec377e03..658eb6eccf 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -255,7 +255,7 @@ public: mSourceType = chat.mSourceType; //*TODO overly defensive thing, source type should be maintained out there - if((chat.mFromID.isNull() && chat.mFromName.empty()) || chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull()) + if((chat.mFromID.isNull() && chat.mFromName.empty()) || (chat.mFromName == SYSTEM_FROM && chat.mFromID.isNull())) { mSourceType = CHAT_SOURCE_SYSTEM; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b604908474..092e48e459 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2807,24 +2807,99 @@ void renderComplexityDisplay(LLDrawable* drawablep) return; } + if (!voVol->isRoot()) + { + return; + } + LLVOVolume::texture_cost_t textures; - F32 cost = (F32) voVol->getRenderCost(textures) / (F32) LLVOVolume::getRenderComplexityMax(); + F32 cost = (F32) voVol->getRenderCost(textures); + + // add any child volumes + LLViewerObject::const_child_list_t children = voVol->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); iter != children.end(); ++iter) + { + const LLViewerObject *child = *iter; + const LLVOVolume *child_volume = dynamic_cast(child); + if (child_volume) + { + cost += child_volume->getRenderCost(textures); + } + } + + // add texture cost + for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter) + { + // add the cost of each individual texture in the linkset + cost += iter->second; + } + + F32 cost_max = (F32) LLVOVolume::getRenderComplexityMax(); + + + + // allow user to set a static color scale + if (gSavedSettings.getS32("RenderComplexityStaticMax") > 0) + { + cost_max = gSavedSettings.getS32("RenderComplexityStaticMax"); + } + + F32 cost_ratio = cost / cost_max; + + // cap cost ratio at 1.0f in case cost_max is at a low threshold + cost_ratio = cost_ratio > 1.0f ? 1.0f : cost_ratio; LLGLEnable blend(GL_BLEND); - F32 red = cost; - F32 green = 1.0f - cost; + LLColor4 color; + const LLColor4 color_min = gSavedSettings.getColor4("RenderComplexityColorMin"); + const LLColor4 color_mid = gSavedSettings.getColor4("RenderComplexityColorMid"); + const LLColor4 color_max = gSavedSettings.getColor4("RenderComplexityColorMax"); + + if (cost_ratio < 0.5f) + { + color = color_min * (1 - cost_ratio * 2) + color_mid * (cost_ratio * 2); + } + else + { + color = color_mid * (1 - (cost_ratio - 0.5) * 2) + color_max * ((cost_ratio - 0.5) * 2); + } - glColor4f(red,green,0,0.5f); + LLSD color_val = color.getValue(); - S32 num_faces = drawablep->getNumFaces(); - if (num_faces) + // don't highlight objects below the threshold + if (cost > gSavedSettings.getS32("RenderComplexityThreshold")) { - for (S32 i = 0; i < num_faces; ++i) + glColor4f(color[0],color[1],color[2],0.5f); + + + S32 num_faces = drawablep->getNumFaces(); + if (num_faces) { - pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX); + for (S32 i = 0; i < num_faces; ++i) + { + pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX); + } } - } + LLViewerObject::const_child_list_t children = voVol->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); iter != children.end(); ++iter) + { + const LLViewerObject *child = *iter; + if (child) + { + num_faces = child->getNumFaces(); + if (num_faces) + { + for (S32 i = 0; i < num_faces; ++i) + { + pushVerts(child->mDrawable->getFace(i), LLVertexBuffer::MAP_VERTEX); + } + } + } + } + } + + voVol->setDebugText(llformat("%4.0f", cost)); } void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) @@ -4170,7 +4245,8 @@ void LLSpatialPartition::renderDebug() LLPipeline::RENDER_DEBUG_AVATAR_VOLUME | LLPipeline::RENDER_DEBUG_AGENT_TARGET | //LLPipeline::RENDER_DEBUG_BUILD_QUEUE | - LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) + LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA | + LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)) { return; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 30be2fb8e0..f3e58ce73d 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -993,7 +993,7 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_AGENT_TARGET; } - else if ("" == info_display) + else if ("rendercomplexity" == info_display) { return LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY; } -- cgit v1.2.3