Use 64bit integers for texture memory

master
Ansariel 2016-03-31 11:18:11 +02:00
parent 356b838823
commit 973965d5ec
4 changed files with 48 additions and 15 deletions

View File

@ -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);
// <FS:Ansariel> 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);
// </FS:Ansariel>
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)
// <FS:Ansariel> 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)
// </FS:Ansariel>
{
LLImageGL::sCurBoundTextureMemory += mem ;
return LLImageGL::sCurBoundTextureMemory.value();

View File

@ -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) ;
// <FS:Ansariel> 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) ;
// </FS:Ansariel>
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
// <FS:Ansariel> 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
// </FS:Ansariel>
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;

View File

@ -95,11 +95,18 @@ S32 LLViewerTexture::sAuxCount = 0;
LLFrameTimer LLViewerTexture::sEvaluationTimer;
F32 LLViewerTexture::sDesiredDiscardBias = 0.f;
F32 LLViewerTexture::sDesiredDiscardScale = 1.1f;
S32Bytes LLViewerTexture::sBoundTextureMemory;
S32Bytes LLViewerTexture::sTotalTextureMemory;
// <FS:Ansariel> Texture memory management
//S32Bytes LLViewerTexture::sBoundTextureMemory;
//S32Bytes LLViewerTexture::sTotalTextureMemory;
S64Bytes LLViewerTexture::sBoundTextureMemory;
S64Bytes LLViewerTexture::sTotalTextureMemory;
// </FS:Ansariel>
S32Megabytes LLViewerTexture::sMaxBoundTextureMemory;
S32Megabytes LLViewerTexture::sMaxTotalTextureMem;
S32Bytes LLViewerTexture::sMaxDesiredTextureMem;
// <FS:Ansariel> Texture memory management
//S32Bytes LLViewerTexture::sMaxDesiredTextureMem;
S64Bytes LLViewerTexture::sMaxDesiredTextureMem;
// </FS:Ansariel>
S8 LLViewerTexture::sCameraMovingDiscardBias = 0;
F32 LLViewerTexture::sCameraMovingBias = 0.0f;
S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size
@ -577,7 +584,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));
// <FS:Ansariel> Texture memory management
//sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75, F64Bytes(gMaxVideoRam));
// </FS:Ansariel>
// If we are using more texture memory than we should,
// scale up the desired discard level

View File

@ -217,11 +217,18 @@ public:
static LLFrameTimer sEvaluationTimer;
static F32 sDesiredDiscardBias;
static F32 sDesiredDiscardScale;
static S32Bytes sBoundTextureMemory;
static S32Bytes sTotalTextureMemory;
// <FS:Ansariel> Texture memory management
//static S32Bytes sBoundTextureMemory;
//static S32Bytes sTotalTextureMemory;
static S64Bytes sBoundTextureMemory;
static S64Bytes sTotalTextureMemory;
// </FS:Ansariel>
static S32Megabytes sMaxBoundTextureMemory;
static S32Megabytes sMaxTotalTextureMem;
static S32Bytes sMaxDesiredTextureMem ;
// <FS:Ansariel> Texture memory management
//static S32Bytes sMaxDesiredTextureMem ;
static S64Bytes sMaxDesiredTextureMem ;
// </FS:Ansariel>
static S8 sCameraMovingDiscardBias;
static F32 sCameraMovingBias;
static S32 sMaxSculptRez ;