diff options
author | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-03-23 16:01:12 -0400 |
---|---|---|
committer | Nyx (Neal Orman) <nyx@lindenlab.com> | 2011-03-23 16:01:12 -0400 |
commit | 9f2987d995e8a2273f723a387dd587c3dc988056 (patch) | |
tree | 04afb70ca61d13df494b4022c74c4d1763eeaa14 /indra | |
parent | d7eb9b36fe7c801d9bbb554ef40c3d8d712f5bfb (diff) |
second pass at render complexity debug display.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmath/lloctree.h | 2 | ||||
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 73 | ||||
-rw-r--r-- | indra/newview/llchathistory.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 96 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 2 |
5 files changed, 161 insertions, 14 deletions
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index fdfc24f8b7..179ad7ecfd 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -294,7 +294,7 @@ public: //is it here? if (isInside(data->getPositionGroup())) { - if ((getElementCount() < LL_OCTREE_MAX_CAPACITY && contains(data->getBinRadius()) || + if (((getElementCount() < LL_OCTREE_MAX_CAPACITY && contains(data->getBinRadius())) || (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= LL_OCTREE_MAX_CAPACITY))) { //it belongs here #if LL_OCTREE_PARANOIA_CHECK 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 @@ <key>RenderAvatarComplexityLimit</key> <map> <key>Comment</key> - <string>Max visual complexity of avatars in a scens</string> + <string>Max visual complexity of avatars in a scene</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>-1</integer> + </map> + <key>RenderComplexityColorMin</key> + <map> + <key>Comment</key> + <string>Max visual complexity of avatars in a scene</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.0</real> + <real>0.0</real> + <real>1.0</real> + <real>0.5</real> + </array> + </map> + <key>RenderComplexityColorMid</key> + <map> + <key>Comment</key> + <string>Max visual complexity of avatars in a scene</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>0.0</real> + <real>1.0</real> + <real>0.0</real> + <real>0.5</real> + </array> + </map> + <key>RenderComplexityColorMax</key> + <map> + <key>Comment</key> + <string>Max visual complexity of avatars in a scene</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Color4</string> + <key>Value</key> + <array> + <real>1.0</real> + <real>0.0</real> + <real>0.0</real> + <real>0.5</real> + </array> + </map> + <key>RenderComplexityThreshold</key> + <map> + <key>Comment</key> + <string>Only color objects higher than render threshold</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>-1</integer> + </map> + <key>RenderComplexityStaticMax</key> + <map> + <key>Comment</key> + <string>Sets a static max value for scaling of RenderComplexity + display (-1 for dynamic scaling)</string> <key>Persist</key> <integer>1</integer> <key>Type</key> 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<const LLVOVolume*>(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; } |