summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2011-03-22 20:39:31 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2011-03-22 20:39:31 -0400
commit29dc641fbe7ab77f77fe19e2e7976980f0649b5b (patch)
tree4190aef1ee4b0465e55bfa91d22f74db318fff9c /indra/newview
parent955b727550e8595fd67c55775d8f0fe249826277 (diff)
initial effort to enable a debug display to show render complexity.
Using for internal demo, will get it code reviewed if it merges in.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llspatialpartition.cpp38
-rwxr-xr-xindra/newview/llviewermenu.cpp4
-rw-r--r--indra/newview/llviewerobjectlist.cpp4
-rw-r--r--indra/newview/llvovolume.cpp18
-rw-r--r--indra/newview/llvovolume.h10
-rw-r--r--indra/newview/pipeline.h1
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml10
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_terrain.xml34
8 files changed, 116 insertions, 3 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 5e7af6bbb3..b604908474 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2792,6 +2792,40 @@ void renderUpdateType(LLDrawable* drawablep)
}
}
+void renderComplexityDisplay(LLDrawable* drawablep)
+{
+ LLViewerObject* vobj = drawablep->getVObj();
+ if (!vobj)
+ {
+ return;
+ }
+
+ LLVOVolume *voVol = dynamic_cast<LLVOVolume*>(vobj);
+
+ if (!voVol)
+ {
+ return;
+ }
+
+ LLVOVolume::texture_cost_t textures;
+ F32 cost = (F32) voVol->getRenderCost(textures) / (F32) LLVOVolume::getRenderComplexityMax();
+
+ LLGLEnable blend(GL_BLEND);
+
+ F32 red = cost;
+ F32 green = 1.0f - cost;
+
+ glColor4f(red,green,0,0.5f);
+
+ S32 num_faces = drawablep->getNumFaces();
+ if (num_faces)
+ {
+ for (S32 i = 0; i < num_faces; ++i)
+ {
+ pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX);
+ }
+ }
+}
void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
{
@@ -3906,6 +3940,10 @@ public:
{
renderUpdateType(drawable);
}
+ if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY))
+ {
+ renderComplexityDisplay(drawable);
+ }
LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get());
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index f5b0857425..30be2fb8e0 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -993,6 +993,10 @@ U32 info_display_from_string(std::string info_display)
{
return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
}
+ else if ("" == info_display)
+ {
+ return LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY;
+ }
else
{
return 0;
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 0071753831..2e8eb9f4a8 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -58,6 +58,7 @@
#include "llviewerregion.h"
#include "llviewerstats.h"
#include "llviewerstatsrecorder.h"
+#include "llvovolume.h"
#include "llvoavatarself.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
@@ -997,6 +998,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
mNumSizeCulled = 0;
mNumVisCulled = 0;
+ // update max computed render cost
+ LLVOVolume::updateRenderComplexity();
+
// compute all sorts of time-based stats
// don't factor frames that were paused into the stats
if (! mWasPaused)
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e2d1850e58..7c772ce835 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -87,6 +87,8 @@ F32 LLVOVolume::sLODFactor = 1.f;
F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
F32 LLVOVolume::sDistanceFactor = 1.0f;
S32 LLVOVolume::sNumLODChanges = 0;
+S32 LLVOVolume::mRenderComplexity_last = 0;
+S32 LLVOVolume::mRenderComplexity_current = 0;
LLPointer<LLObjectMediaDataClient> LLVOVolume::sObjectMediaClient = NULL;
LLPointer<LLObjectMediaNavigateClient> LLVOVolume::sObjectMediaNavigateClient = NULL;
@@ -3206,6 +3208,11 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
shame += num_particles * part_size * ARC_PARTICLE_COST;
}
+ if (shame > mRenderComplexity_current)
+ {
+ mRenderComplexity_current = (S32)shame;
+ }
+
return (U32)shame;
}
@@ -3223,7 +3230,14 @@ F32 LLVOVolume::getStreamingCost()
return 0.f;
}
-U32 LLVOVolume::getTriangleCount()
+//static
+void LLVOVolume::updateRenderComplexity()
+{
+ mRenderComplexity_last = mRenderComplexity_current;
+ mRenderComplexity_current = 0;
+}
+
+U32 LLVOVolume::getTriangleCount() const
{
U32 count = 0;
LLVolume* volume = getVolume();
@@ -4068,7 +4082,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if ( bindCnt > 0 )
{
const int jointCnt = pSkinData->mJointNames.size();
- const int pelvisZOffset = pSkinData->mPelvisOffset;
+ const int pelvisZOffset = (int)pSkinData->mPelvisOffset;
bool fullRig = (jointCnt>=20) ? true : false;
if ( fullRig )
{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 5af88c6cbd..57faee556f 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -132,7 +132,7 @@ public:
typedef std::map<LLUUID, S32> texture_cost_t;
U32 getRenderCost(texture_cost_t &textures) const;
/*virtual*/ F32 getStreamingCost();
- /*virtual*/ U32 getTriangleCount();
+ /*virtual*/ U32 getTriangleCount() const;
/*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
S32 face = -1, // which face to check, -1 = ALL_SIDES
BOOL pick_transparent = FALSE,
@@ -320,11 +320,19 @@ protected:
LLFace* addFace(S32 face_index);
void updateTEData();
+ // stats tracking for render complexity
+ static S32 mRenderComplexity_last;
+ static S32 mRenderComplexity_current;
+
void requestMediaDataUpdate(bool isNew);
void cleanUpMediaImpls();
void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ;
void removeMediaImpl(S32 texture_index) ;
public:
+
+ static S32 getRenderComplexityMax() {return mRenderComplexity_last;}
+ static void updateRenderComplexity();
+
LLViewerTextureAnim *mTextureAnimp;
U8 mTexAnimMode;
private:
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index be58af947c..02bb6d618e 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -448,6 +448,7 @@ public:
RENDER_DEBUG_PHYSICS_SHAPES = 0x1000000,
RENDER_DEBUG_NORMALS = 0x2000000,
RENDER_DEBUG_LOD_INFO = 0x4000000,
+ RENDER_DEBUG_RENDER_COMPLEXITY = 0x8000000
};
public:
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index ea40a08c95..7a227fb5f9 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2338,6 +2338,16 @@
function="Advanced.ToggleInfoDisplay"
parameter="raycast" />
</menu_item_check>
+ <menu_item_check
+ label="Render Complexity"
+ name="rendercomplexity">
+ <menu_item_check.on_check
+ function="Advanced.CheckInfoDisplay"
+ parameter="rendercomplexity" />
+ <menu_item_check.on_click
+ function="Advanced.ToggleInfoDisplay"
+ parameter="rendercomplexity" />
+ </menu_item_check>
</menu>
<menu
create_jump_keys="true"
diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain.xml b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
index 5093c52129..d7a629e543 100644
--- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml
@@ -115,6 +115,40 @@
name="apply_btn"
top="135"
width="90" />
+ <combo_box
+ height="23"
+ layout="topleft"
+ left="50"
+ name="SkyPresetsCombo"
+ top="165"
+ width="150" />
+ <combo_box
+ height="23"
+ layout="topleft"
+ left="200"
+ name="WaterPresetsCombo"
+ top="165"
+ width="150" />
+ <button
+ enabled="false"
+ follows="left|top"
+ height="20"
+ label="Apply"
+ layout="topleft"
+ left="370"
+ name="wes_apply_btn"
+ top="165"
+ width="90" />
+ <button
+ enabled="false"
+ follows="left|top"
+ height="20"
+ label="Edit Environment"
+ layout="topleft"
+ left="370"
+ name="env_editor_btn"
+ top="195"
+ width="120" />
<view_border
bevel_style="none"
follows="top|left"