summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-xindra/newview/llviewerregion.cpp98
1 files changed, 63 insertions, 35 deletions
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;