viewer#2875 Proportionally agressive vram cleanup
parent
72ce0248f1
commit
fa5aba2b67
|
|
@ -505,8 +505,12 @@ void LLViewerTexture::updateClass()
|
|||
|
||||
F32 budget = max_vram_budget == 0 ? (F32)gGLManager.mVRAM : (F32)max_vram_budget;
|
||||
|
||||
// try to leave half a GB for everyone else, but keep at least 768MB for ourselves
|
||||
F32 target = llmax(budget - 512.f, MIN_VRAM_BUDGET);
|
||||
// Try to leave at least half a GB for everyone else and for bias,
|
||||
// but keep at least 768MB for ourselves
|
||||
// Viewer can 'overshoot' target when scene changes, if viewer goes over budget it
|
||||
// can negatively impact performance, so leave 20% of a breathing room for
|
||||
// 'bias' calculation to kick in.
|
||||
F32 target = llmax(llmin(budget - 512.f, budget * 0.8f), MIN_VRAM_BUDGET);
|
||||
sFreeVRAMMegabytes = target - used;
|
||||
|
||||
F32 over_pct = (used - target) / target;
|
||||
|
|
@ -522,7 +526,7 @@ void LLViewerTexture::updateClass()
|
|||
// slam to 1.5 bias the moment we hit low memory (discards off screen textures immediately)
|
||||
sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f);
|
||||
|
||||
if (is_sys_low)
|
||||
if (is_sys_low || over_pct > 2.f)
|
||||
{ // if we're low on system memory, emergency purge off screen textures to avoid a death spiral
|
||||
LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL;
|
||||
for (auto& image : gTextureList)
|
||||
|
|
|
|||
|
|
@ -1169,6 +1169,11 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
|
|||
|
||||
//update MIN_UPDATE_COUNT or 5% of other textures, whichever is greater
|
||||
update_count = llmax((U32) MIN_UPDATE_COUNT, (U32) mUUIDMap.size()/20);
|
||||
if (LLViewerTexture::sDesiredDiscardBias > 1.f)
|
||||
{
|
||||
// we are over memory target, update more agresively
|
||||
update_count = (S32)(update_count * LLViewerTexture::sDesiredDiscardBias);
|
||||
}
|
||||
update_count = llmin(update_count, (U32) mUUIDMap.size());
|
||||
|
||||
{ // copy entries out of UUID map to avoid iterator invalidation from deletion inside updateImageDecodeProiroty or updateFetch below
|
||||
|
|
|
|||
Loading…
Reference in New Issue