summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rw-r--r--indra/newview/llvocache.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 27c105c8d6..52a6afc2d0 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -486,14 +486,21 @@ void LLVOCacheEntry::updateDebugSettings()
//min radius: all objects within this radius remain loaded in memory
static LLCachedControl<F32> min_radius(gSavedSettings,"SceneLoadMinRadius");
static const F32 MIN_RADIUS = 1.0f;
- const F32 draw_radius = gAgentCamera.mDrawDistance;
+
+ F32 draw_radius = gAgentCamera.mDrawDistance;
+ if (LLViewerTexture::isSystemMemoryCritical())
+ {
+ // Factor is intended to go from 1.0 to 2.0
+ // For safety cap reduction at 50%, we don't want to go below half of draw distance
+ draw_radius = llmax(draw_radius / LLViewerTexture::getSystemMemoryBudgetFactor(), draw_radius / 2.f);
+ }
const F32 clamped_min_radius = llclamp((F32) min_radius, MIN_RADIUS, draw_radius); // [1, mDrawDistance]
sNearRadius = MIN_RADIUS + ((clamped_min_radius - MIN_RADIUS) * adjust_factor);
// a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold
static LLCachedControl<F32> rear_max_radius_frac(gSavedSettings,"SceneLoadRearMaxRadiusFraction");
const F32 min_radius_plus_one = sNearRadius + 1.f;
- const F32 max_radius = rear_max_radius_frac * gAgentCamera.mDrawDistance;
+ const F32 max_radius = rear_max_radius_frac * draw_radius;
const F32 clamped_max_radius = llclamp(max_radius, min_radius_plus_one, draw_radius); // [sNearRadius, mDrawDistance]
sRearFarRadius = min_radius_plus_one + ((clamped_max_radius - min_radius_plus_one) * adjust_factor);
@@ -1875,11 +1882,11 @@ void LLVOCache::removeGenericExtrasForHandle(U64 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)
+ handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle);
+ if (iter != mHandleEntryMap.end())
{
- LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << entry->mHandle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
- removeEntry(entry);
+ LL_WARNS("GLTF", "VOCache") << "Removing generic extras for handle " << handle << "Filename: " << getObjectCacheExtrasFilename(handle) << LL_ENDL;
+ removeEntry(iter->second);
}
else
{