From 3089e1a17a1f5bac1487fa56796f2b52244886e9 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 11 Dec 2009 12:07:35 -0500 Subject: EXT-2718 avatar render cost higher in 2.0 than in 1.23 previous fix fixed the double-counting of texture costs. resulting ARC was ~99 points higher for most avatars. This patch makes the cost shoot up again, as ARC was improperly computed in 1.23 and before. This makes the cost for an avatar increase 10 points per prim instead of per-attachment, which is how we have documented it. Also used constants to eliminate magic numbers and increased ARC limit from 1024 to 2048. Will request feedback on change from BSI:STU Code reviewed by Bigpapi --HG-- branch : avatar-pipeline --- indra/newview/llfloatertools.cpp | 2 +- indra/newview/llvoavatar.cpp | 12 +++++++----- indra/newview/llvovolume.cpp | 29 +++++++++++++++++++++++++++-- indra/newview/llvovolume.h | 2 ++ 4 files changed, 37 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 6ba032c152..d08d47bc81 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -991,7 +991,7 @@ S32 LLFloaterTools::calcRenderCost() if (viewer_volume) { cost += viewer_volume->getRenderCost(textures); - cost += textures.size() * 5; + cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST; textures.clear(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 03910b0534..226d85ec99 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7651,6 +7651,9 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di void LLVOAvatar::idleUpdateRenderCost() { + static const U32 ARC_BODY_PART_COST = 20; + static const U32 ARC_LIMIT = 2048; + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) { return; @@ -7667,7 +7670,7 @@ void LLVOAvatar::idleUpdateRenderCost() { if (isTextureVisible(tex_index)) { - cost +=20; + cost +=ARC_BODY_PART_COST; } } } @@ -7687,7 +7690,6 @@ void LLVOAvatar::idleUpdateRenderCost() const LLDrawable* drawable = attached_object->mDrawable; if (drawable) { - cost += 10; const LLVOVolume* volume = drawable->getVOVolume(); if (volume) { @@ -7698,11 +7700,11 @@ void LLVOAvatar::idleUpdateRenderCost() } } - cost += textures.size() * 5; + cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST; 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); + F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); + F32 red = llmin((F32) cost/(F32)ARC_LIMIT, 1.f); mText->setColor(LLColor4(red,green,0,1)); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index cf61994fea..36d6d2c04b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2587,7 +2587,22 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const // children, and cost should only be increased for unique textures -Nyx U32 LLVOVolume::getRenderCost(std::set &textures) const { - U32 shame = 0; + // base cost of each prim should be 10 points + static const U32 ARC_PRIM_COST = 10; + // per-prim costs + static const U32 ARC_INVISI_COST = 1; + static const U32 ARC_SHINY_COST = 1; + static const U32 ARC_GLOW_COST = 1; + static const U32 ARC_FLEXI_COST = 8; + static const U32 ARC_PARTICLE_COST = 16; + static const U32 ARC_BUMP_COST = 4; + + // per-face costs + static const U32 ARC_PLANAR_COST = 1; + static const U32 ARC_ANIM_TEX_COST = 4; + static const U32 ARC_ALPHA_COST = 4; + + U32 shame = ARC_PRIM_COST; U32 invisi = 0; U32 shiny = 0; @@ -2663,7 +2678,17 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const } } - shame += invisi + shiny + glow + alpha*4 + flexi*8 + animtex*4 + particles*16+bump*4+scale+planar; + + shame += invisi * ARC_INVISI_COST; + shame += shiny * ARC_SHINY_COST; + shame += glow * ARC_GLOW_COST; + shame += alpha * ARC_ALPHA_COST; + shame += flexi * ARC_FLEXI_COST; + shame += animtex * ARC_ANIM_TEX_COST; + shame += particles * ARC_PARTICLE_COST; + shame += bump * ARC_BUMP_COST; + shame += planar * ARC_PLANAR_COST; + shame += scale; LLViewerObject::const_child_list_t& child_list = getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 06e214b41e..fe4b5488fa 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -310,6 +310,8 @@ public: static LLPointer sObjectMediaClient; static LLPointer sObjectMediaNavigateClient; + static const U32 ARC_TEXTURE_COST = 5; + protected: static S32 sNumLODChanges; -- cgit v1.2.3