diff options
| author | Cosmic Linden <cosmic@lindenlab.com> | 2026-01-02 21:34:34 -0500 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2026-01-05 20:45:57 +0200 |
| commit | 4f70d8c830c6213bafcbf40f5ff7eb72840739cc (patch) | |
| tree | edc9d8f247c1de858ef5c1d3c2e7eb26c1661af1 /indra/newview/llvovolume.cpp | |
| parent | 11e16d5ae73ec7dd0a738cb5ee2a8d2457176409 (diff) | |
secondlife/viewer#2462: Optimize unloading of prims
Signed-off-by: Rye <rye@alchemyviewer.org>
Diffstat (limited to 'indra/newview/llvovolume.cpp')
| -rw-r--r-- | indra/newview/llvovolume.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d1318018c9..c68ed01cc1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -250,10 +250,13 @@ LLVOVolume::~LLVOVolume() delete mVolumeImpl; mVolumeImpl = NULL; - gMeshRepo.unregisterMesh(this); + unregisterOldMeshAndSkin(); + llassert(!gMeshRepo.forceUnregisterMesh(this)); if(!mMediaImplList.empty()) { + LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("delete volume media list"); + for(U32 i = 0 ; i < mMediaImplList.size() ; i++) { if(mMediaImplList[i].notNull()) @@ -1048,6 +1051,28 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline) return mDrawable; } +// Inverse of gMeshRepo.loadMesh and gMeshRepo.getSkinInfo, combined into one function +// Assume a Collada mesh never changes after being set. +void LLVOVolume::unregisterOldMeshAndSkin() +{ + if (mVolumep) + { + const LLVolumeParams& params = mVolumep->getParams(); + if ((params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) + { + // object is being deleted, so it will no longer need to request + // meshes. + for (S32 lod = 0; lod != LLVolumeLODGroup::NUM_LODS; ++lod) + { + gMeshRepo.unregisterMesh(this, params, lod); + } + // This volume may or may not have a skin + gMeshRepo.unregisterSkinInfo(params.getSculptID(), this); + } + } +} + + bool LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bool unique_volume) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME; |
