Tweak memory detection algorithm.

This commit is contained in:
Shyotl
2019-07-02 21:14:37 -05:00
parent 4622be4cef
commit b5cb6459b0
6 changed files with 104 additions and 44 deletions

View File

@@ -525,15 +525,15 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
sBoundTextureMemory = LLImageGL::sBoundTextureMemory;
sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;
sMaxBoundTextureMemory = S32Megabytes(gTextureList.getMaxResidentTexMem());
sMaxTotalTextureMem = S32Megabytes(gTextureList.getMaxTotalTextureMem());
sMaxBoundTextureMemory = gTextureList.getMaxResidentTexMem();
sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem();
sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small.
if (sBoundTextureMemory >= sMaxBoundTextureMemory ||
sTotalTextureMemory >= sMaxTotalTextureMem)
{
//when texture memory overflows, lower down the threshold to release the textures more aggressively.
sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
sMaxDesiredTextureMem = llmin(F64Bytes(sMaxDesiredTextureMem) * 0.75f, F64Bytes(gMaxVideoRam));
// If we are using more texture memory than we should,
// scale up the desired discard level