summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatertools.cpp6
-rw-r--r--indra/newview/llvoavatar.cpp22
-rw-r--r--indra/newview/llvovolume.cpp12
-rw-r--r--indra/newview/llvovolume.h2
4 files changed, 28 insertions, 14 deletions
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 9854d2594b..6d30d375f9 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -975,6 +975,8 @@ void LLFloaterTools::onClickGridOptions()
S32 LLFloaterTools::calcRenderCost()
{
S32 cost = 0;
+ std::set<LLUUID> textures;
+
for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin();
selection_iter != LLSelectMgr::getInstance()->getSelection()->end();
++selection_iter)
@@ -985,11 +987,13 @@ S32 LLFloaterTools::calcRenderCost()
LLVOVolume *viewer_volume = (LLVOVolume*)select_node->getObject();
if (viewer_volume)
{
- cost += viewer_volume->getRenderCost();
+ cost += viewer_volume->getRenderCost(textures);
}
}
}
+ cost += textures.size() * 5;
+
return cost;
}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 75e35e5221..9e75d7853d 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7636,15 +7636,19 @@ void LLVOAvatar::idleUpdateRenderCost()
return;
}
- U32 shame = 0;
+ U32 cost = 0;
+ std::set<LLUUID> textures;
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
{
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
ETextureIndex tex_index = baked_dict->mTextureIndex;
- if (isTextureVisible(tex_index))
+ if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(WT_SKIRT)))
{
- shame +=20;
+ if (isTextureVisible(tex_index))
+ {
+ cost +=20;
+ }
}
}
@@ -7663,20 +7667,22 @@ void LLVOAvatar::idleUpdateRenderCost()
const LLDrawable* drawable = attached_object->mDrawable;
if (drawable)
{
- shame += 10;
+ cost += 10;
const LLVOVolume* volume = drawable->getVOVolume();
if (volume)
{
- shame += volume->getRenderCost();
+ cost += volume->getRenderCost(textures);
}
}
}
}
}
- setDebugText(llformat("%d", shame));
- F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f);
- F32 red = llmin((F32) shame/1024.f, 1.f);
+ cost += textures.size() * 5;
+
+ setDebugText(llformat("%d", cost));
+ F32 green = 1.f-llclamp(((F32) cost-1024.f)/1024.f, 0.f, 1.f);
+ F32 red = llmin((F32) cost/1024.f, 1.f);
mText->setColor(LLColor4(red,green,0,1));
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index e5531a1497..1f49cd30c7 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2541,7 +2541,11 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const
return mDrawable->getWorldMatrix();
}
-U32 LLVOVolume::getRenderCost() const
+// Returns a base cost and adds textures to passed in set.
+// total cost is returned value + 5 * size of the resulting set.
+// Cannot include cost of textures, as they may be re-used in linked
+// children, and cost should only be increased for unique textures -Nyx
+U32 LLVOVolume::getRenderCost(std::set<LLUUID> &textures) const
{
U32 shame = 0;
@@ -2574,7 +2578,7 @@ U32 LLVOVolume::getRenderCost() const
{
const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT);
LLUUID sculpt_id = sculpt_params->getSculptTexture();
- shame += 5;
+ textures.insert(sculpt_id);
}
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
@@ -2583,7 +2587,7 @@ U32 LLVOVolume::getRenderCost() const
const LLTextureEntry* te = face->getTextureEntry();
const LLViewerTexture* img = face->getTexture();
- shame += 5;
+ textures.insert(img->getID());
if (face->getPoolType() == LLDrawPool::POOL_ALPHA)
{
@@ -2633,7 +2637,7 @@ U32 LLVOVolume::getRenderCost() const
const LLVOVolume* child_volumep = child_drawablep->getVOVolume();
if (child_volumep)
{
- shame += child_volumep->getRenderCost();
+ shame += child_volumep->getRenderCost(textures);
}
}
}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index fb543efc04..6bad245e19 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -120,7 +120,7 @@ public:
const LLMatrix4& getRelativeXform() const { return mRelativeXform; }
const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; }
/*virtual*/ const LLMatrix4 getRenderMatrix() const;
- U32 getRenderCost() const;
+ U32 getRenderCost(std::set<LLUUID> &textures) const;
/*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
S32 face = -1, // which face to check, -1 = ALL_SIDES