diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-06-12 16:13:23 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-06-12 16:13:23 +0100 |
commit | a8c87d5ba8082f60a5a7c2ed40563df50c439ee5 (patch) | |
tree | 768ff4102c33b48d9c52bc9323c78fe57463e11c /indra/newview | |
parent | 6bf8fb58dee419cf2a15d6bdbd5acbcbd65dc033 (diff) |
SL-915 - avoid excess updates to avatar spatial extent
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 5 |
2 files changed, 25 insertions, 7 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 9848a568da..7a138b26a4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -697,6 +697,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mNeedsImpostorUpdate = TRUE; mNeedsAnimUpdate = TRUE; + mNeedsExtentUpdate = true; + mImpostorDistance = 0; mImpostorPixelArea = 0; @@ -1258,6 +1260,15 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) { return; } + + if (mNeedsExtentUpdate) + { + calculateSpatialExtents(newMin,newMax); + mLastAnimExtents[0].set(newMin.getF32ptr()); + mLastAnimExtents[1].set(newMax.getF32ptr()); + mNeedsExtentUpdate = false; + } + if (isImpostor() && !needsImpostorUpdate()) { LLVector3 delta = getRenderPosition() - @@ -1268,9 +1279,8 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) } else { - getSpatialExtents(newMin,newMax); - mLastAnimExtents[0].set(newMin.getF32ptr()); - mLastAnimExtents[1].set(newMax.getF32ptr()); + newMin.load3(mLastAnimExtents[0].mV); + newMax.load3(mLastAnimExtents[1].mV); LLVector4a pos_group; pos_group.setAdd(newMin,newMax); pos_group.mul(0.5f); @@ -1281,7 +1291,7 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) static LLTrace::BlockTimerStatHandle FTM_AVATAR_EXTENT_UPDATE("Avatar Update Extent"); -void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) +void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) { LL_RECORD_BLOCK_TIME(FTM_AVATAR_EXTENT_UPDATE); @@ -2402,6 +2412,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) return; } + // Update should be happening max once per frame. + mNeedsExtentUpdate = true; + LLScopedContextString str("avatar_idle_update " + getFullname()); checkTextureLoading() ; @@ -2684,8 +2697,10 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) } else { - //VECTORIZE THIS - getSpatialExtents(ext[0], ext[1]); + ext[0].load3(mLastAnimExtents[0].mV); + ext[1].load3(mLastAnimExtents[1].mV); + // AXON just do this once per frame + //calculateSpatialExtents(ext[0], ext[1]); LLVector4a diff; diff.setSub(ext[1], mImpostorExtents[1]); if (diff.getLength3().getF32() > 0.05f) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 09712e6d84..42b04ef870 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -162,7 +162,7 @@ public: /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); /*virtual*/ void updateRegion(LLViewerRegion *regionp); /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax); - /*virtual*/ void getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); + void calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax); /*virtual*/ BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, @@ -528,7 +528,10 @@ public: private: LLVector3 mImpostorOffset; LLVector2 mImpostorDim; + // This becomes true in the constructor and false after the first + // idleUpdateMisc(). Not clear it serves any purpose. BOOL mNeedsAnimUpdate; + bool mNeedsExtentUpdate; LLVector3 mImpostorAngle; F32 mImpostorDistance; F32 mImpostorPixelArea; |