summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-29 19:08:41 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2017-09-29 19:08:41 +0100
commit853924c7efd5c1d067c237d5a44c44db313745e9 (patch)
tree8ef0def6c5cd2640284b63be82a02315745d8398
parent31f84c2a9a86a7f25eadcb1720a7a9292480be16 (diff)
SL-794 - use largest LOD for est tri count, instead of trusting that it's always the high LOD
-rw-r--r--indra/newview/llmeshrepository.cpp13
-rw-r--r--indra/newview/llmeshrepository.h3
-rw-r--r--indra/newview/llselectmgr.cpp2
-rw-r--r--indra/newview/llviewerobject.cpp8
-rw-r--r--indra/newview/llviewerobject.h4
-rw-r--r--indra/newview/llvovolume.cpp19
-rw-r--r--indra/newview/llvovolume.h2
7 files changed, 30 insertions, 21 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 92c2be4a8b..093afdb880 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -4021,9 +4021,9 @@ void LLMeshRepository::uploadError(LLSD& args)
mUploadErrorQ.push(args);
}
-F32 LLMeshRepository::getEstTrianglesHigh(LLUUID mesh_id)
+F32 LLMeshRepository::getEstTrianglesMax(LLUUID mesh_id)
{
- F32 triangles_high = 0.f;
+ F32 triangles_max = 0.f;
if (mThread && mesh_id.notNull())
{
LLMutexLock lock(mThread->mHeaderMutex);
@@ -4039,13 +4039,18 @@ F32 LLMeshRepository::getEstTrianglesHigh(LLUUID mesh_id)
}
S32 bytes_high = header["high_lod"]["size"].asInteger();
+ S32 bytes_med = header["medium_lod"]["size"].asInteger();
+ S32 bytes_low = header["low_lod"]["size"].asInteger();
+ S32 bytes_lowest = header["lowest_lod"]["size"].asInteger();
+ S32 bytes_max = llmax(bytes_high, bytes_med, bytes_low, bytes_lowest);
+
F32 METADATA_DISCOUNT = (F32) gSavedSettings.getU32("MeshMetaDataDiscount"); //discount 128 bytes to cover the cost of LLSD tags and compression domain overhead
F32 MINIMUM_SIZE = (F32) gSavedSettings.getU32("MeshMinimumByteSize"); //make sure nothing is "free"
F32 bytes_per_triangle = (F32) gSavedSettings.getU32("MeshBytesPerTriangle");
- triangles_high = llmax((F32) bytes_high-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
+ triangles_max = llmax((F32) bytes_max-METADATA_DISCOUNT, MINIMUM_SIZE)/bytes_per_triangle;
}
}
- return triangles_high;
+ return triangles_max;
}
F32 LLMeshRepository::getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value)
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 28f037b85e..d2eac449f7 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -472,7 +472,8 @@ public:
static LLDeadmanTimer sQuiescentTimer; // Time-to-complete-mesh-downloads after significant events
- F32 getEstTrianglesHigh(LLUUID mesh_id);
+ // Estimated triangle count of the largest LOD
+ F32 getEstTrianglesMax(LLUUID mesh_id);
F32 getStreamingCost(LLUUID mesh_id, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
static F32 getStreamingCost(LLSD& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL);
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index d3f240ac91..81fd228997 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -7444,7 +7444,7 @@ bool LLObjectSelection::checkAnimatedObjectEstTris()
{
anim_count++;
}
- est_tris += object->recursiveGetEstTrianglesHigh();
+ est_tris += object->recursiveGetEstTrianglesMax();
max_tris = llmax((F32)max_tris,(F32)object->getAnimatedObjectMaxTris());
}
return anim_count==0 || est_tris <= max_tris;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 99c68dab10..616db8ae2f 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -3580,14 +3580,14 @@ F32 LLViewerObject::getLinksetPhysicsCost()
return mLinksetPhysicsCost;
}
-F32 LLViewerObject::recursiveGetEstTrianglesHigh() const
+F32 LLViewerObject::recursiveGetEstTrianglesMax() const
{
- F32 est_tris = getEstTrianglesHigh();
+ F32 est_tris = getEstTrianglesMax();
for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++)
{
const LLViewerObject* child = *iter;
- est_tris += child->recursiveGetEstTrianglesHigh();
+ est_tris += child->recursiveGetEstTrianglesMax();
}
return est_tris;
}
@@ -3607,7 +3607,7 @@ S32 LLViewerObject::getAnimatedObjectMaxTris() const
return max_tris;
}
-F32 LLViewerObject::getEstTrianglesHigh() const
+F32 LLViewerObject::getEstTrianglesMax() const
{
return 0.f;
}
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index a1a7eed002..345fd1fb27 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -358,8 +358,8 @@ public:
virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE);
S32 getAnimatedObjectMaxTris() const;
- F32 recursiveGetEstTrianglesHigh() const;
- virtual F32 getEstTrianglesHigh() const;
+ F32 recursiveGetEstTrianglesMax() const;
+ virtual F32 getEstTrianglesMax() const;
virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const;
virtual U32 getTriangleCount(S32* vcount = NULL) const;
virtual U32 getHighLODTriangleCount();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 121fb9c11e..efddc9235e 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3376,7 +3376,7 @@ bool LLVOVolume::canBeAnimatedObject() const
{
return false;
}
- F32 est_tris = recursiveGetEstTrianglesHigh();
+ F32 est_tris = recursiveGetEstTrianglesMax();
if (est_tris > getAnimatedObjectMaxTris())
{
LL_INFOS() << "est_tris " << est_tris << " exceeds limit " << getAnimatedObjectMaxTris() << LL_ENDL;
@@ -3388,12 +3388,15 @@ bool LLVOVolume::canBeAnimatedObject() const
bool LLVOVolume::isAnimatedObject() const
{
LLVOVolume *root_vol = (LLVOVolume*)getRootEdit();
- bool can_be_animated = canBeAnimatedObject();
- bool root_can_be_animated = root_vol->canBeAnimatedObject();
- bool root_is_animated = root_vol->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG;
- if (can_be_animated && root_can_be_animated && root_is_animated)
+ bool root_is_animated_flag = root_vol->getExtendedMeshFlags() & LLExtendedMeshParams::ANIMATED_MESH_ENABLED_FLAG;
+ if (root_is_animated_flag)
{
- return true;
+ bool root_can_be_animated = root_vol->canBeAnimatedObject();
+ bool this_can_be_animated = ((root_vol == this) && root_can_be_animated) || canBeAnimatedObject();
+ if (this_can_be_animated && root_can_be_animated)
+ {
+ return true;
+ }
}
return false;
}
@@ -3852,11 +3855,11 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const
return (U32)shame;
}
-F32 LLVOVolume::getEstTrianglesHigh() const
+F32 LLVOVolume::getEstTrianglesMax() const
{
if (isMesh())
{
- return gMeshRepo.getEstTrianglesHigh(getVolume()->getParams().getSculptID());
+ return gMeshRepo.getEstTrianglesMax(getVolume()->getParams().getSculptID());
}
return 0.f;
}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 5891b36da8..24bcf41c74 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -134,7 +134,7 @@ public:
/*virtual*/ const LLMatrix4 getRenderMatrix() const;
typedef std::map<LLUUID, S32> texture_cost_t;
U32 getRenderCost(texture_cost_t &textures) const;
- /*virtual*/ F32 getEstTrianglesHigh() const;
+ /*virtual*/ F32 getEstTrianglesMax() const;
F32 getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const;
/*virtual*/ F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL) { return getStreamingCost(bytes, visible_bytes, NULL); }