diff options
author | Brad Linden <brad@lindenlab.com> | 2023-03-23 16:51:30 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2023-03-23 16:54:13 -0700 |
commit | cf3a0c77f1855aa1a33ff39f86e846e7fb9031d1 (patch) | |
tree | 2056e852b3a8923c285f8e6d2ee15e74a1071fca | |
parent | b72c66ae688c5b5c90ea7675fc65aeefbf6b87fc (diff) |
Fix for SL-18458 overrides not applying when cache load happened before LLViewerObject::updateTEMaterialTextures call
-rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 39 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llviewerregion.h | 4 |
5 files changed, 42 insertions, 17 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 678ec7e46b..9c78e48cab 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -366,6 +366,8 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) { LL_PROFILE_ZONE_SCOPED; + + llassert(obj); const LLUUID& id = obj->getID(); auto iter = mQueuedOverrides.find(id); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index cc7e716bb5..1c53bddb62 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4963,12 +4963,16 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) mat = (LLFetchedGLTFMaterial*) gGLTFMaterialList.getMaterial(mat_id); if (mat->isFetching()) { // material is not loaded yet, rebuild draw info when the object finishes loading - LLUUID id = getID(); - mat->onMaterialComplete([=] + mat->onMaterialComplete([id=getID()] { LLViewerObject* obj = gObjectList.findObject(id); if (obj) { + LLViewerRegion* region = obj->getRegion(); + if(region) + { + region->loadCacheMiscExtras(obj->getLocalID()); + } obj->markForUpdate(FALSE); } }); @@ -5698,6 +5702,23 @@ void LLViewerObject::setDebugText(const std::string &utf8text) updateText(); } +void LLViewerObject::appendDebugText(const std::string &utf8text) +{ + if (utf8text.empty() && !mText) + { + return; + } + + if (!mText) + { + initHudText(); + } + mText->addLine(utf8text, LLColor4::white); + mText->setZCompare(FALSE); + mText->setDoFade(FALSE); + updateText(); +} + void LLViewerObject::initHudText() { mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT); @@ -7260,12 +7281,14 @@ void LLViewerObject::setRenderMaterialID(S32 te_in, const LLUUID& id, bool updat } else { - LLPointer<LLViewerObject> this_ptr = this; - new_material->onMaterialComplete([this_ptr]() mutable { - if (this_ptr->isDead()) { return; } - - this_ptr->rebuildMaterial(); - }); + new_material->onMaterialComplete([obj_id = getID()]() + { + LLViewerObject* obj = gObjectList.findObject(obj_id); + if (obj) + { + obj->rebuildMaterial(); + } + }); } // predictively update LLRenderMaterialParams (don't wait for server) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 560c51139b..e647fdd045 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -442,6 +442,7 @@ public: void sendMaterialUpdate() const; void setDebugText(const std::string &utf8text); + void appendDebugText(const std::string &utf8text); void initHudText(); void restoreHudText(); void setIcon(LLViewerTexture* icon_image); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4663129d35..dd4ff50259 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -823,7 +823,7 @@ void LLViewerRegion::saveObjectCache() // Map of LLVOCacheEntry takes time to release, store map for cleanup on idle sRegionCacheCleanup.insert(mImpl->mCacheMap.begin(), mImpl->mCacheMap.end()); mImpl->mCacheMap.clear(); - // TODO - probably need to do the same for overrides cache + // TODO - probably need to do the same for overrides cache } void LLViewerRegion::sendMessage() @@ -1151,6 +1151,8 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); entry->setValid(FALSE); + + // TODO kill extras/material overrides cache too } //physically delete the cache entry @@ -1863,7 +1865,7 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) addActiveCacheEntry(entry); } - loadCacheMiscExtras(entry->getLocalID(), entry, entry->getCRC()); + loadCacheMiscExtras(entry->getLocalID()); return obj; } @@ -2879,6 +2881,7 @@ void LLViewerRegion::dumpCache() { LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL; } + // TODO - add overrides cache too } void LLViewerRegion::unpackRegionHandshake() @@ -3547,15 +3550,11 @@ std::string LLViewerRegion::getSimHostName() return std::string("..."); } -void LLViewerRegion::loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc) +void LLViewerRegion::loadCacheMiscExtras(U32 local_id) { auto iter = mImpl->mGLTFOverridesJson.find(local_id); if (iter != mImpl->mGLTFOverridesJson.end()) { LLGLTFMaterialList::loadCacheOverrides(iter->second); } - else - { - LL_DEBUGS("GLTF") << "cache miss for handle: " << mHandle << " local_id:" << local_id << LL_ENDL; - } } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index ec507fb982..b132a3a5f3 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -423,9 +423,9 @@ private: void decodeBoundingInfo(LLVOCacheEntry* entry); bool isNonCacheableObjectCreated(U32 local_id); - void loadCacheMiscExtras(U32 local_id, LLVOCacheEntry * entry, U32 crc); - public: + void loadCacheMiscExtras(U32 local_id); + struct CompareDistance { bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) |