File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ S32 LLViewerTexture::sRawCount = 0;
87
87
S32 LLViewerTexture::sAuxCount = 0 ;
88
88
LLFrameTimer LLViewerTexture::sEvaluationTimer ;
89
89
F32 LLViewerTexture::sDesiredDiscardBias = 0 .f;
90
+ U32 LLViewerTexture::sBiasTexturesUpdated = 0 ;
90
91
91
92
S32 LLViewerTexture::sMaxSculptRez = 128 ; // max sculpt image size
92
93
constexpr S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64 ;
@@ -518,6 +519,7 @@ void LLViewerTexture::updateClass()
518
519
519
520
bool is_sys_low = isSystemMemoryLow ();
520
521
bool is_low = is_sys_low || over_pct > 0 .f ;
522
+ F32 discard_bias = sDesiredDiscardBias ;
521
523
522
524
static bool was_low = false ;
523
525
static bool was_sys_low = false ;
@@ -604,6 +606,12 @@ void LLViewerTexture::updateClass()
604
606
}
605
607
606
608
sDesiredDiscardBias = llclamp (sDesiredDiscardBias , 1 .f , 4 .f );
609
+ if (discard_bias != sDesiredDiscardBias )
610
+ {
611
+ // bias changed, reset texture update counter to
612
+ // let updates happen at an increased rate.
613
+ sBiasTexturesUpdated = 0 ;
614
+ }
607
615
608
616
LLViewerTexture::sFreezeImageUpdates = false ;
609
617
}
Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ class LLViewerTexture : public LLGLTexture
220
220
static S32 sAuxCount ;
221
221
static LLFrameTimer sEvaluationTimer ;
222
222
static F32 sDesiredDiscardBias ;
223
+ static U32 sBiasTexturesUpdated ;
223
224
static S32 sMaxSculptRez ;
224
225
static U32 sMinLargeImageSize ;
225
226
static U32 sMaxSmallImageSize ;
Original file line number Diff line number Diff line change @@ -1198,10 +1198,17 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
1198
1198
1199
1199
// update MIN_UPDATE_COUNT or 5% of other textures, whichever is greater
1200
1200
update_count = llmax ((U32) MIN_UPDATE_COUNT, (U32) mUUIDMap .size ()/20 );
1201
- if (LLViewerTexture::sDesiredDiscardBias > 1 .f )
1201
+ if (LLViewerTexture::sDesiredDiscardBias > 1 .f
1202
+ && LLViewerTexture::sBiasTexturesUpdated < (U32)mUUIDMap .size ())
1202
1203
{
1203
- // we are over memory target, update more agresively
1204
+ // We are over memory target. Bias affects discard rates, so update
1205
+ // existing textures agresively to free memory faster.
1204
1206
update_count = (S32)(update_count * LLViewerTexture::sDesiredDiscardBias );
1207
+
1208
+ // This isn't particularly precise and can overshoot, but it doesn't need
1209
+ // to be, just making sure it did a full circle and doesn't get stuck updating
1210
+ // at bias = 4 with 4 times the rate permanently.
1211
+ LLViewerTexture::sBiasTexturesUpdated += update_count;
1205
1212
}
1206
1213
update_count = llmin (update_count, (U32) mUUIDMap .size ());
1207
1214
You can’t perform that action at this time.
0 commit comments