summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llgltfmateriallist.cpp8
-rwxr-xr-xindra/newview/llviewerregion.cpp98
-rw-r--r--indra/newview/llviewerregion.h3
-rw-r--r--indra/newview/llvocache.cpp36
4 files changed, 96 insertions, 49 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index e97eb552cf..4c9dc8f7cd 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -244,12 +244,8 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
}
}
- // Workaround for server sending empty overrides.
- if(cache.mSides.size() > 0)
- {
- region->cacheFullUpdateGLTFOverride(cache);
- LL_DEBUGS("GLTF") << "GLTF Material Override: " << cache.mObjectId << " " << cache.mLocalId << " " << cache.mRegionHandle << " (sides:" << (cache.mSides.size()) << ")" << LL_ENDL;
- }
+ region->cacheFullUpdateGLTFOverride(cache);
+ LL_DEBUGS("GLTF") << "GLTF Material Override: " << cache.mObjectId << " " << cache.mLocalId << " " << cache.mRegionHandle << " (sides:" << (cache.mSides.size()) << ")" << LL_ENDL;
}
}
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 160e2f7e5c..29dce088f5 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2447,45 +2447,61 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
setSimulatorFeaturesReceived(true);
- // if region has MaxTextureResolution, set max_texture_dimension settings, otherwise use default
- if (mSimulatorFeatures.has("MaxTextureResolution"))
- {
- S32 max_texture_resolution = mSimulatorFeatures["MaxTextureResolution"].asInteger();
- gSavedSettings.setS32("max_texture_dimension_X", max_texture_resolution);
- gSavedSettings.setS32("max_texture_dimension_Y", max_texture_resolution);
- }
- else
- {
- gSavedSettings.setS32("max_texture_dimension_X", 1024);
- gSavedSettings.setS32("max_texture_dimension_Y", 1024);
- }
+ // WARNING: this is called from a coroutine, and flipping saved settings has a LOT of side effects, shuttle
+ // the work below back to the main loop
+ //
+
+ // copy features to lambda in case the region is deleted before the lambda is executed
+ LLSD features = mSimulatorFeatures;
+
+ auto work = [=]()
+ {
+ // if region has MaxTextureResolution, set max_texture_dimension settings, otherwise use default
+ if (features.has("MaxTextureResolution"))
+ {
+ S32 max_texture_resolution = features["MaxTextureResolution"].asInteger();
+ gSavedSettings.setS32("max_texture_dimension_X", max_texture_resolution);
+ gSavedSettings.setS32("max_texture_dimension_Y", max_texture_resolution);
+ }
+ else
+ {
+ gSavedSettings.setS32("max_texture_dimension_X", 1024);
+ gSavedSettings.setS32("max_texture_dimension_Y", 1024);
+ }
- bool mirrors_enabled = false;
- if (mSimulatorFeatures.has("MirrorsEnabled"))
- {
- mirrors_enabled = mSimulatorFeatures["MirrorsEnabled"].asBoolean();
- }
+ bool mirrors_enabled = false;
+ if (features.has("MirrorsEnabled"))
+ {
+ mirrors_enabled = features["MirrorsEnabled"].asBoolean();
+ }
- gSavedSettings.setBOOL("RenderMirrors", mirrors_enabled);
+ gSavedSettings.setBOOL("RenderMirrors", mirrors_enabled);
- if (mSimulatorFeatures.has("PBRTerrainEnabled"))
- {
- bool enabled = mSimulatorFeatures["PBRTerrainEnabled"];
- gSavedSettings.setBOOL("RenderTerrainPBREnabled", enabled);
- }
- else
- {
- gSavedSettings.setBOOL("RenderTerrainPBREnabled", false);
- }
+ if (features.has("PBRTerrainEnabled"))
+ {
+ bool enabled = features["PBRTerrainEnabled"];
+ gSavedSettings.setBOOL("RenderTerrainPBREnabled", enabled);
+ }
+ else
+ {
+ gSavedSettings.setBOOL("RenderTerrainPBREnabled", false);
+ }
- if (mSimulatorFeatures.has("PBRMaterialSwatchEnabled"))
- {
- bool enabled = mSimulatorFeatures["PBRMaterialSwatchEnabled"];
- gSavedSettings.setBOOL("UIPreviewMaterial", enabled);
- }
- else
+ if (features.has("PBRMaterialSwatchEnabled"))
+ {
+ bool enabled = features["PBRMaterialSwatchEnabled"];
+ gSavedSettings.setBOOL("UIPreviewMaterial", enabled);
+ }
+ else
+ {
+ gSavedSettings.setBOOL("UIPreviewMaterial", false);
+ }
+ };
+
+ auto workqueue = LL::WorkQueue::getInstance("mainloop");
+ if (workqueue)
{
- gSavedSettings.setBOOL("UIPreviewMaterial", false);
+ LL::WorkQueue::postMaybe(workqueue, work);
}
}
@@ -2744,7 +2760,14 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec
void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data)
{
U32 local_id = override_data.mLocalId;
- mImpl->mGLTFOverridesLLSD[local_id] = override_data;
+ if (override_data.mSides.size() > 0)
+ { // empty override means overrides were removed from this object
+ mImpl->mGLTFOverridesLLSD[local_id] = override_data;
+ }
+ else
+ {
+ mImpl->mGLTFOverridesLLSD.erase(local_id);
+ }
}
LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id)
@@ -2961,6 +2984,11 @@ void LLViewerRegion::dumpCache()
// TODO - add overrides cache too
}
+void LLViewerRegion::clearVOCacheFromMemory()
+{
+ mImpl->mCacheMap.clear();
+}
+
void LLViewerRegion::unpackRegionHandshake()
{
LLMessageSystem *msg = gMessageSystem;
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 1c2ff9bc97..1c89cc4e6d 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -378,7 +378,8 @@ public:
LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp);
void findOrphans(U32 parent_id);
void clearCachedVisibleObjects();
- void dumpCache();
+ void dumpCache ();
+ void clearVOCacheFromMemory();
void unpackRegionHandshake();
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 82ffd1d522..8dad833eaa 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -1272,6 +1272,13 @@ void LLVOCache::removeEntry(HeaderEntryInfo* entry)
getObjectCacheFilename(entry->mHandle, filename);
LL_INFOS() << "Removing entry for region with filename" << filename << LL_ENDL;
+ // make sure corresponding LLViewerRegion also clears its in-memory cache
+ LLViewerRegion* regionp = LLWorld::instance().getRegionFromHandle(entry->mHandle);
+ if (regionp)
+ {
+ regionp->clearVOCacheFromMemory();
+ }
+
header_entry_queue_t::iterator iter = mHeaderEntryQueue.find(entry);
if(iter != mHeaderEntryQueue.end())
{
@@ -1340,10 +1347,14 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry)
std::string filename;
getObjectCacheFilename(entry->mHandle, filename);
+ LL_WARNS("GLTF", "VOCache") << "Removing object cache for handle " << entry->mHandle << "Filename: " << filename << LL_ENDL;
LLAPRFile::remove(filename, mLocalAPRFilePoolp);
- // Note: `removeFromCache` should take responsibility for cleaning up all cache artefacts specfic to the handle/entry.
+
+ // Note: `removeFromCache` should take responsibility for cleaning up all cache artefacts specfic to the handle/entry.
// as such this now includes the generic extras
- removeGenericExtrasForHandle(entry->mHandle);
+ filename = getObjectCacheExtrasFilename(entry->mHandle);
+ LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << filename << LL_ENDL;
+ LLFile::remove(filename);
entry->mTime = INVALID_TIME ;
updateEntry(entry) ; //update the head file.
@@ -1358,7 +1369,7 @@ void LLVOCache::readCacheHeader()
}
//clear stale info.
- clearCacheInMemory();
+ clearCacheInMemory();
bool success = true ;
if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
@@ -1605,7 +1616,7 @@ void LLVOCache::readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCac
}
// For future versions we may call a legacy handler here, but realistically we'll just consider this cache out of date.
// The important thing is to make sure it gets removed.
- if(versionNumber != LLGLTFOverrideCacheEntry::VERSION && versionNumber != 0)
+ if(versionNumber != LLGLTFOverrideCacheEntry::VERSION)
{
LL_WARNS() << "Unexpected version number " << versionNumber << " for extras cache for handle " << handle << LL_ENDL;
in.close();
@@ -1614,7 +1625,7 @@ void LLVOCache::readGenericExtrasFromCache(U64 handle, const LLUUID& id, LLVOCac
}
LL_DEBUGS("VOCache") << "Reading extras cache for handle " << handle << ", version " << versionNumber << LL_ENDL;
-
+ std::getline(in, line);
if(!LLUUID::validate(line))
{
LL_WARNS() << "Failed reading extras cache for handle" << handle << ". invalid uuid line: '" << line << "'" << LL_ENDL;
@@ -1847,8 +1858,19 @@ void LLVOCache::removeGenericExtrasForHandle(U64 handle)
LL_WARNS() << "Not removing cache for handle " << handle << ": Cache is currently in read-only mode." << LL_ENDL;
return ;
}
- LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << handle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
- LLFile::remove(getObjectCacheExtrasFilename(handle));
+
+ // NOTE: when removing the extras, we must also remove the objects so the simulator will send us a full upddate with the valid overrides
+ auto* entry = mHandleEntryMap[handle];
+ if (entry)
+ {
+ removeEntry(entry);
+ }
+ else
+ {
+ //shouldn't happen, but if it does, we should remove the extras file since it's orphaned
+ LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
+ LLFile::remove(getObjectCacheExtrasFilename(entry->mHandle));
+ }
}
void LLVOCache::writeGenericExtrasToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_gltf_overrides_map_t& cache_extras_entry_map, BOOL dirty_cache, bool removal_enabled)