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/llvoavatar.cpp | |
parent | 6bf8fb58dee419cf2a15d6bdbd5acbcbd65dc033 (diff) |
SL-915 - avoid excess updates to avatar spatial extent
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 27 |
1 files changed, 21 insertions, 6 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) |