EXT-2718 EXT-2434 avatar render cost changes

Fixing a but in new ARC function where textures added 5 to the ARC for each
use. Expected (and previous) behavior restored, where 5 is added to ARC for each
unique texture, regardless of how many faces it is used on.

Confirmed new ARC is 99 points higher than previous (20 for each body part), or
119 if avatar is wearing a skirt.

Will be post-reviewed before pushing

--HG--
branch : avatar-pipeline
meow-7.2.2
Nyx (Neal Orman) 2009-11-23 15:12:48 -05:00
parent 24dbd81763
commit ca5e49d5fa
4 changed files with 28 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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