second pass at render complexity debug display.

meow-7.2.2
Nyx (Neal Orman) 2011-03-23 16:01:12 -04:00
parent d7eb9b36fe
commit 9f2987d995
5 changed files with 162 additions and 15 deletions

View File

@ -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

View File

@ -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>

View File

@ -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;
}

View File

@ -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");
glColor4f(red,green,0,0.5f);
S32 num_faces = drawablep->getNumFaces();
if (num_faces)
if (cost_ratio < 0.5f)
{
for (S32 i = 0; i < num_faces; ++i)
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);
}
LLSD color_val = color.getValue();
// don't highlight objects below the threshold
if (cost > gSavedSettings.getS32("RenderComplexityThreshold"))
{
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;
}

View File

@ -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;
}