Use 64bit integers for texture memory

Thu, 31 Mar 2016 11:18:11 +0200

author
Ansariel
date
Thu, 31 Mar 2016 11:18:11 +0200
changeset 48939
a3cdd242aeb5
parent 48938
2c54d70b8709
child 48940
c268654db1ee

Use 64bit integers for texture memory

indra/llrender/llimagegl.cpp file | annotate | diff | revisions
indra/llrender/llimagegl.h file | annotate | diff | revisions
indra/newview/llviewertexture.cpp file | annotate | diff | revisions
indra/newview/llviewertexture.h file | annotate | diff | revisions
     1.1 --- a/indra/llrender/llimagegl.cpp	Tue Apr 05 18:15:08 2016 +0200
     1.2 +++ b/indra/llrender/llimagegl.cpp	Thu Mar 31 11:18:11 2016 +0200
     1.3 @@ -51,9 +51,14 @@
     1.4  
     1.5  U32 LLImageGL::sUniqueCount				= 0;
     1.6  U32 LLImageGL::sBindCount				= 0;
     1.7 -S32Bytes LLImageGL::sGlobalTextureMemory(0);
     1.8 -S32Bytes LLImageGL::sBoundTextureMemory(0);
     1.9 -S32Bytes LLImageGL::sCurBoundTextureMemory(0);
    1.10 +// <FS:Ansariel> Texture memory management
    1.11 +//S32Bytes LLImageGL::sGlobalTextureMemory(0);
    1.12 +//S32Bytes LLImageGL::sBoundTextureMemory(0);
    1.13 +//S32Bytes LLImageGL::sCurBoundTextureMemory(0);
    1.14 +S64Bytes LLImageGL::sGlobalTextureMemory(0);
    1.15 +S64Bytes LLImageGL::sBoundTextureMemory(0);
    1.16 +S64Bytes LLImageGL::sCurBoundTextureMemory(0);
    1.17 +// </FS:Ansariel>
    1.18  S32 LLImageGL::sCount					= 0;
    1.19  
    1.20  BOOL LLImageGL::sGlobalUseAnisotropic	= FALSE;
    1.21 @@ -251,7 +256,10 @@
    1.22  }
    1.23  
    1.24  //static
    1.25 -S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category)
    1.26 +// <FS:Ansariel> Texture memory management
    1.27 +//S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category)
    1.28 +S64 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category)
    1.29 +// </FS:Ansariel>
    1.30  {
    1.31  	LLImageGL::sCurBoundTextureMemory += mem ;
    1.32  	return LLImageGL::sCurBoundTextureMemory.value();
     2.1 --- a/indra/llrender/llimagegl.h	Tue Apr 05 18:15:08 2016 +0200
     2.2 +++ b/indra/llrender/llimagegl.h	Thu Mar 31 11:18:11 2016 +0200
     2.3 @@ -69,7 +69,10 @@
     2.4  	static void dirtyTexOptions();
     2.5  
     2.6  	// Sometimes called externally for textures not using LLImageGL (should go away...)	
     2.7 -	static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ;
     2.8 +	// <FS:Ansariel> Texture memory management
     2.9 +	//static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ;
    2.10 +	static S64 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ;
    2.11 +	// </FS:Ansariel>
    2.12  	
    2.13  	static bool checkSize(S32 width, S32 height);
    2.14  
    2.15 @@ -242,9 +245,14 @@
    2.16  	static F32 sLastFrameTime;
    2.17  
    2.18  	// Global memory statistics
    2.19 -	static S32Bytes sGlobalTextureMemory;	// Tracks main memory texmem
    2.20 -	static S32Bytes sBoundTextureMemory;	// Tracks bound texmem for last completed frame
    2.21 -	static S32Bytes sCurBoundTextureMemory;		// Tracks bound texmem for current frame
    2.22 +	// <FS:Ansariel> Texture memory management
    2.23 +	//static S32Bytes sGlobalTextureMemory;	// Tracks main memory texmem
    2.24 +	//static S32Bytes sBoundTextureMemory;	// Tracks bound texmem for last completed frame
    2.25 +	//static S32Bytes sCurBoundTextureMemory;		// Tracks bound texmem for current frame
    2.26 +	static S64Bytes sGlobalTextureMemory;	// Tracks main memory texmem
    2.27 +	static S64Bytes sBoundTextureMemory;	// Tracks bound texmem for last completed frame
    2.28 +	static S64Bytes sCurBoundTextureMemory;		// Tracks bound texmem for current frame
    2.29 +	// </FS:Ansariel>
    2.30  	static U32 sBindCount;					// Tracks number of texture binds for current frame
    2.31  	static U32 sUniqueCount;				// Tracks number of unique texture binds for current frame
    2.32  	static BOOL sGlobalUseAnisotropic;
     3.1 --- a/indra/newview/llviewertexture.cpp	Tue Apr 05 18:15:08 2016 +0200
     3.2 +++ b/indra/newview/llviewertexture.cpp	Thu Mar 31 11:18:11 2016 +0200
     3.3 @@ -95,11 +95,18 @@
     3.4  LLFrameTimer LLViewerTexture::sEvaluationTimer;
     3.5  F32 LLViewerTexture::sDesiredDiscardBias = 0.f;
     3.6  F32 LLViewerTexture::sDesiredDiscardScale = 1.1f;
     3.7 -S32Bytes LLViewerTexture::sBoundTextureMemory;
     3.8 -S32Bytes LLViewerTexture::sTotalTextureMemory;
     3.9 +// <FS:Ansariel> Texture memory management
    3.10 +//S32Bytes LLViewerTexture::sBoundTextureMemory;
    3.11 +//S32Bytes LLViewerTexture::sTotalTextureMemory;
    3.12 +S64Bytes LLViewerTexture::sBoundTextureMemory;
    3.13 +S64Bytes LLViewerTexture::sTotalTextureMemory;
    3.14 +// </FS:Ansariel>
    3.15  S32Megabytes LLViewerTexture::sMaxBoundTextureMemory;
    3.16  S32Megabytes LLViewerTexture::sMaxTotalTextureMem;
    3.17 -S32Bytes LLViewerTexture::sMaxDesiredTextureMem;
    3.18 +// <FS:Ansariel> Texture memory management
    3.19 +//S32Bytes LLViewerTexture::sMaxDesiredTextureMem;
    3.20 +S64Bytes LLViewerTexture::sMaxDesiredTextureMem;
    3.21 +// </FS:Ansariel>
    3.22  S8  LLViewerTexture::sCameraMovingDiscardBias = 0;
    3.23  F32 LLViewerTexture::sCameraMovingBias = 0.0f;
    3.24  S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size
    3.25 @@ -577,7 +584,10 @@
    3.26  		sTotalTextureMemory >= sMaxTotalTextureMem)
    3.27  	{
    3.28  		//when texture memory overflows, lower down the threshold to release the textures more aggressively.
    3.29 -		sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
    3.30 +		// <FS:Ansariel> Texture memory management
    3.31 +		//sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
    3.32 +		sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75, F64Bytes(gMaxVideoRam));
    3.33 +		// </FS:Ansariel>
    3.34  	
    3.35  		// If we are using more texture memory than we should,
    3.36  		// scale up the desired discard level
     4.1 --- a/indra/newview/llviewertexture.h	Tue Apr 05 18:15:08 2016 +0200
     4.2 +++ b/indra/newview/llviewertexture.h	Thu Mar 31 11:18:11 2016 +0200
     4.3 @@ -217,11 +217,18 @@
     4.4  	static LLFrameTimer sEvaluationTimer;
     4.5  	static F32 sDesiredDiscardBias;
     4.6  	static F32 sDesiredDiscardScale;
     4.7 -	static S32Bytes sBoundTextureMemory;
     4.8 -	static S32Bytes sTotalTextureMemory;
     4.9 +	// <FS:Ansariel> Texture memory management
    4.10 +	//static S32Bytes sBoundTextureMemory;
    4.11 +	//static S32Bytes sTotalTextureMemory;
    4.12 +	static S64Bytes sBoundTextureMemory;
    4.13 +	static S64Bytes sTotalTextureMemory;
    4.14 +	// </FS:Ansariel>
    4.15  	static S32Megabytes sMaxBoundTextureMemory;
    4.16  	static S32Megabytes sMaxTotalTextureMem;
    4.17 -	static S32Bytes sMaxDesiredTextureMem ;
    4.18 +	// <FS:Ansariel> Texture memory management
    4.19 +	//static S32Bytes sMaxDesiredTextureMem ;
    4.20 +	static S64Bytes sMaxDesiredTextureMem ;
    4.21 +	// </FS:Ansariel>
    4.22  	static S8  sCameraMovingDiscardBias;
    4.23  	static F32 sCameraMovingBias;
    4.24  	static S32 sMaxSculptRez ;

mercurial