diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 03204ea48fcf8a9e2e0104d8600b49075821c19e..d351b38653db5e062ae0cda85db47de7ea8e23a1 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -268,8 +268,10 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio LLSD info = LLSD::emptyMap(); U32 avatar_complexity = avatar->getVisualComplexity(); - if (avatar_complexity > 0) + if (avatar_complexity > 0) { + // the weight/complexity is unsigned, but LLSD only stores signed integers, + // so if it's over that (which would be ridiculously high), just store the maximum signed int value info[KEY_WEIGHT] = (S32)(avatar_complexity < S32_MAX ? avatar_complexity : S32_MAX); info[KEY_TOO_COMPLEX] = LLSD::Boolean(avatar->isTooComplex()); agents[avatar->getID().asString()] = info; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 11b619ba006ef9f9cde9d57d9421aac1d7b76ac9..da3f344e007aeeeebaf1fbcfd0af159a008e0b3b 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -862,8 +862,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node) { if (bridge->mAvatar.notNull()) { - bridge->mAvatar->modifyAttachmentGeometryBytes( -mGeometryBytes ); - bridge->mAvatar->modifyAttachmentSurfaceArea( -mSurfaceArea ); + bridge->mAvatar->subtractAttachmentSizes( mGeometryBytes, mSurfaceArea ); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 303b677dcf572d6603a869f340230430f4756907..5d83a20f509d3505a103bc825c04a82ac610ac3b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8283,15 +8283,16 @@ void LLVOAvatar::idleUpdateRenderComplexity() } } -void LLVOAvatar::modifyAttachmentGeometryBytes(S32 delta) +void LLVOAvatar::addAttachmentSizes(U32 delta_bytes, F32 delta_area) { - mAttachmentGeometryBytes = llmax(mAttachmentGeometryBytes + delta, 0); + mAttachmentGeometryBytes += delta_bytes; + mAttachmentSurfaceArea += delta_area; } -void LLVOAvatar::modifyAttachmentSurfaceArea(F32 delta) +void LLVOAvatar::subtractAttachmentSizes(U32 delta_bytes, F32 delta_area) { - F32 newval = mAttachmentSurfaceArea + delta; - mAttachmentSurfaceArea = ( newval > 0.0 ? newval : 0.0 ); + mAttachmentGeometryBytes = delta_bytes > mAttachmentGeometryBytes ? 0 : mAttachmentGeometryBytes - delta_bytes; + mAttachmentSurfaceArea = delta_area > mAttachmentSurfaceArea ? 0.0 : mAttachmentSurfaceArea - delta_area; } void LLVOAvatar::updateVisualComplexity() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5f690be4c567dd31182aeeec80ee36e23fed50e1..fb19f4eb2ec7483a3f3852276febb5f0310b5438 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -258,9 +258,9 @@ class LLVOAvatar : U32 getVisualComplexity() { return mVisualComplexity; }; // Numbers calculated here by rendering AV S32 getAttachmentGeometryBytes() { return mAttachmentGeometryBytes; }; // number of bytes in attached geometry - void modifyAttachmentGeometryBytes(S32 delta); F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; }; // estimated surface area of attachments - void modifyAttachmentSurfaceArea(F32 delta); + void addAttachmentSizes(U32 delta_bytes, F32 delta_area); + void subtractAttachmentSizes(U32 delta_bytes, F32 delta_area); U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; }; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 160e2fbdb357268f01cd06fcb0a7ea4861733954..44ba09c17111df4fa36a493a8ee0bf83e1e855ce 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4703,8 +4703,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (pAvatarVO) { - pAvatarVO->modifyAttachmentGeometryBytes( -group->mGeometryBytes ); - pAvatarVO->modifyAttachmentSurfaceArea( -group->mSurfaceArea ); + pAvatarVO->subtractAttachmentSizes( group->mGeometryBytes, group->mSurfaceArea ); } group->mGeometryBytes = 0; @@ -5258,8 +5257,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (pAvatarVO) { - pAvatarVO->modifyAttachmentGeometryBytes( group->mGeometryBytes ); - pAvatarVO->modifyAttachmentSurfaceArea( group->mSurfaceArea ); + pAvatarVO->addAttachmentSizes( group->mGeometryBytes, group->mSurfaceArea ); } }