From 980ac325ca522cbb8a8896ab6a57e39371d24ca9 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 26 Apr 2015 20:16:55 +0200 Subject: [PATCH] FIRE-15947: Setting texmem to 1GB causes bias going up to 5 --- indra/llrender/llimagegl.cpp | 16 ++++++++++++---- indra/llrender/llimagegl.h | 16 ++++++++++++---- indra/newview/llviewertexture.cpp | 18 ++++++++++++++---- indra/newview/llviewertexture.h | 13 ++++++++++--- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index b58b6a5570..5f8260c512 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,14 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -S32Bytes LLImageGL::sGlobalTextureMemory(0); -S32Bytes LLImageGL::sBoundTextureMemory(0); -S32Bytes LLImageGL::sCurBoundTextureMemory(0); +// Texture memory management +//S32Bytes LLImageGL::sGlobalTextureMemory(0); +//S32Bytes LLImageGL::sBoundTextureMemory(0); +//S32Bytes LLImageGL::sCurBoundTextureMemory(0); +S64Bytes LLImageGL::sGlobalTextureMemory(0); +S64Bytes LLImageGL::sBoundTextureMemory(0); +S64Bytes LLImageGL::sCurBoundTextureMemory(0); +// S32 LLImageGL::sCount = 0; BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; @@ -251,7 +256,10 @@ void LLImageGL::updateStats(F32 current_time) } //static -S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) +// Texture memory management +//S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) +S64 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) +// { LLImageGL::sCurBoundTextureMemory += mem ; return LLImageGL::sCurBoundTextureMemory.value(); diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 21982eab1d..50d879a903 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -69,7 +69,10 @@ public: static void dirtyTexOptions(); // Sometimes called externally for textures not using LLImageGL (should go away...) - static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ; + // Texture memory management + //static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ; + static S64 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ; + // static bool checkSize(S32 width, S32 height); @@ -242,9 +245,14 @@ public: static F32 sLastFrameTime; // Global memory statistics - static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem - static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame - static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame + // Texture memory management + //static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem + //static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + //static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame + static S64Bytes sGlobalTextureMemory; // Tracks main memory texmem + static S64Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + static S64Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame + // static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index ec02059647..5e526e2004 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -93,11 +93,18 @@ S32 LLViewerTexture::sAuxCount = 0; LLFrameTimer LLViewerTexture::sEvaluationTimer; F32 LLViewerTexture::sDesiredDiscardBias = 0.f; F32 LLViewerTexture::sDesiredDiscardScale = 1.1f; -S32Bytes LLViewerTexture::sBoundTextureMemory; -S32Bytes LLViewerTexture::sTotalTextureMemory; +// Texture memory management +//S32Bytes LLViewerTexture::sBoundTextureMemory; +//S32Bytes LLViewerTexture::sTotalTextureMemory; +S64Bytes LLViewerTexture::sBoundTextureMemory; +S64Bytes LLViewerTexture::sTotalTextureMemory; +// S32Megabytes LLViewerTexture::sMaxBoundTextureMemory; S32Megabytes LLViewerTexture::sMaxTotalTextureMem; -S32Bytes LLViewerTexture::sMaxDesiredTextureMem; +// Texture memory management +//S32Bytes LLViewerTexture::sMaxDesiredTextureMem; +S64Bytes LLViewerTexture::sMaxDesiredTextureMem; +// S8 LLViewerTexture::sCameraMovingDiscardBias = 0; F32 LLViewerTexture::sCameraMovingBias = 0.0f; S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size @@ -560,7 +567,10 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity sTotalTextureMemory >= sMaxTotalTextureMem) { //when texture memory overflows, lower down the threshold to release the textures more aggressively. - sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam)); + // Texture memory management + //sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam)); + sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75, F64Bytes(gMaxVideoRam)); + // // If we are using more texture memory than we should, // scale up the desired discard level diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 8caf38eff7..afd71404d0 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -208,11 +208,18 @@ public: static LLFrameTimer sEvaluationTimer; static F32 sDesiredDiscardBias; static F32 sDesiredDiscardScale; - static S32Bytes sBoundTextureMemory; - static S32Bytes sTotalTextureMemory; + // Texture memory management + //static S32Bytes sBoundTextureMemory; + //static S32Bytes sTotalTextureMemory; + static S64Bytes sBoundTextureMemory; + static S64Bytes sTotalTextureMemory; + // static S32Megabytes sMaxBoundTextureMemory; static S32Megabytes sMaxTotalTextureMem; - static S32Bytes sMaxDesiredTextureMem ; + // Texture memory management + //static S32Bytes sMaxDesiredTextureMem ; + static S64Bytes sMaxDesiredTextureMem ; + // static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; static S32 sMaxSculptRez ;