From 0aaf52c77c6c65258ca580557b6fd0766011471c Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 8 Jul 2022 16:25:21 -0700 Subject: SL-17691: Make objects active if there are too many material updates from the server --- indra/newview/llvovolume.cpp | 21 +++++++++++++++------ indra/newview/llvovolume.h | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index eb8ff29aca..367d8e328d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -230,7 +230,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mMediaImplList.resize(getNumTEs()); mLastFetchedMediaVersion = -1; - mServerVolumeUpdateCount = 0; + mServerDrawableUpdateCount = 0; memset(&mIndexInTex, 0, sizeof(S32) * LLRender::NUM_VOLUME_TEXTURE_CHANNELS); mMDCImplCount = 0; mLastRiggingInfoLOD = -1; @@ -388,6 +388,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); + onDrawableUpdateFromServer(); mFaceMappingChanged = TRUE; mTexAnimMode = 0; } @@ -401,7 +402,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, if (setVolume(volume_params, 0)) { markForUpdate(TRUE); - onVolumeUpdateFromServer(); + onDrawableUpdateFromServer(); } } @@ -412,6 +413,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); + onDrawableUpdateFromServer(); if (result & teDirtyBits) { updateTEData(); @@ -438,9 +440,10 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, if (setVolume(volume_params, 0)) { markForUpdate(TRUE); - onVolumeUpdateFromServer(); + onDrawableUpdateFromServer(); } S32 res2 = unpackTEMessage(*dp); + onDrawableUpdateFromServer(); if (TEM_INVALID == res2) { // There's something bogus in the data that we're unpacking. @@ -501,6 +504,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); + onDrawableUpdateFromServer(); mFaceMappingChanged = TRUE; mTexAnimMode = 0; } @@ -519,6 +523,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, LLDataPackerBinaryBuffer tdp(tdpbuffer, 1024); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureEntry, tdpbuffer, 0, block_num, 1024); S32 result = unpackTEMessage(tdp); + onDrawableUpdateFromServer(); if (result & teDirtyBits) { updateTEData(); @@ -554,11 +559,15 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -void LLVOVolume::onVolumeUpdateFromServer() +// Called when a volume, material, etc is updated by the server, possibly by a +// script. If this occurs too often for this object, mark it as active so that +// it doesn't disrupt the octree/render batches, thereby potentially causing a +// big performance penalty. +void LLVOVolume::onDrawableUpdateFromServer() { constexpr U32 UPDATES_UNTIL_ACTIVE = 8; - ++mServerVolumeUpdateCount; - if (mDrawable && !mDrawable->isActive() && mServerVolumeUpdateCount > UPDATES_UNTIL_ACTIVE) + ++mServerDrawableUpdateCount; + if (mDrawable && !mDrawable->isActive() && mServerDrawableUpdateCount > UPDATES_UNTIL_ACTIVE) { mDrawable->makeActive(); } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 66c87494df..71ac152490 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -170,7 +170,6 @@ public: const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; void markForUpdate(BOOL priority); - void onVolumeUpdateFromServer(); void markForUnload() { LLViewerObject::markForUnload(TRUE); mVolumeChanged = TRUE; } void faceMappingChanged() { mFaceMappingChanged=TRUE; }; @@ -387,6 +386,7 @@ protected: static S32 mRenderComplexity_last; static S32 mRenderComplexity_current; + void onDrawableUpdateFromServer(); void requestMediaDataUpdate(bool isNew); void cleanUpMediaImpls(); void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ; @@ -425,7 +425,7 @@ private: LLPointer mLightTexture; media_list_t mMediaImplList; S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1 - U64 mServerVolumeUpdateCount; + U64 mServerDrawableUpdateCount; S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; S32 mMDCImplCount; -- cgit v1.2.3 From 1614e4390b514de33609ea94835e75c6ddf9b316 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 12 Jul 2022 14:43:31 -0700 Subject: SL-17691: Consolidate calls to onDrawableUpdateFromServer to reduce false positives, change mServerDrawableUpdateCount from U64->U32 --- indra/newview/llvovolume.cpp | 19 ++++++++++++------- indra/newview/llvovolume.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 367d8e328d..f4a938e57d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -326,6 +326,9 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, LLColor4U color; const S32 teDirtyBits = (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR|TEM_CHANGE_MEDIA); + const bool previously_volume_changed = mVolumeChanged; + const bool previously_face_mapping_changed = mFaceMappingChanged; + const bool previously_color_changed = mColorChanged; // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); @@ -388,7 +391,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); - onDrawableUpdateFromServer(); mFaceMappingChanged = TRUE; mTexAnimMode = 0; } @@ -402,7 +404,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, if (setVolume(volume_params, 0)) { markForUpdate(TRUE); - onDrawableUpdateFromServer(); } } @@ -413,7 +414,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // S32 result = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); - onDrawableUpdateFromServer(); if (result & teDirtyBits) { updateTEData(); @@ -440,10 +440,8 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, if (setVolume(volume_params, 0)) { markForUpdate(TRUE); - onDrawableUpdateFromServer(); } S32 res2 = unpackTEMessage(*dp); - onDrawableUpdateFromServer(); if (TEM_INVALID == res2) { // There's something bogus in the data that we're unpacking. @@ -504,7 +502,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, } gPipeline.markTextured(mDrawable); - onDrawableUpdateFromServer(); mFaceMappingChanged = TRUE; mTexAnimMode = 0; } @@ -523,7 +520,6 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, LLDataPackerBinaryBuffer tdp(tdpbuffer, 1024); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextureEntry, tdpbuffer, 0, block_num, 1024); S32 result = unpackTEMessage(tdp); - onDrawableUpdateFromServer(); if (result & teDirtyBits) { updateTEData(); @@ -556,6 +552,15 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, // ...and clean up any media impls cleanUpMediaImpls(); + if (( + (mVolumeChanged && !previously_volume_changed) || + (mFaceMappingChanged && !previously_face_mapping_changed) || + (mColorChanged && !previously_color_changed) + ) + && !mLODChanged) { + onDrawableUpdateFromServer(); + } + return retval; } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 71ac152490..4136c13315 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -425,7 +425,7 @@ private: LLPointer mLightTexture; media_list_t mMediaImplList; S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1 - U64 mServerDrawableUpdateCount; + U32 mServerDrawableUpdateCount; S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; S32 mMDCImplCount; -- cgit v1.2.3