summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-10-21 11:53:29 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-10-21 11:53:29 -0600
commitdbb353d3b0e5cf3aa9d4d8062c527bb52171ef15 (patch)
treed0b78a18caabc03921684c4cc74a40465e3f027c
parent897972636d0fdd0c6dc76e1a337bb43e1aa9bc0c (diff)
fix for SH-2516: Full Bright Geometry Rendering Increases Rapidly, Destroying Frame Rate.
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llviewertexture.cpp47
-rw-r--r--indra/newview/llviewertexture.h1
-rw-r--r--indra/newview/llviewertexturelist.cpp7
4 files changed, 57 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 4e1ef59765..152ee34bbc 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3160,6 +3160,8 @@ void LLAppViewer::handleViewerCrash()
llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ;
+ LLMemory::logMemoryInfo(true) ;
+
//print out recorded call stacks if there are any.
LLError::LLCallStacks::print();
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 280337be0f..786e2b73b1 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -417,6 +417,48 @@ const S32 min_non_tex_system_mem = (128<<20); // 128 MB
F32 texmem_lower_bound_scale = 0.85f;
F32 texmem_middle_bound_scale = 0.925f;
+//static
+bool LLViewerTexture::isMemoryForTextureLow()
+{
+ const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB
+ const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB
+
+ bool low_mem = false ;
+ if (gGLManager.mHasATIMemInfo)
+ {
+ S32 meminfo[4];
+ glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo);
+
+ if(meminfo[0] / 1024 < MIN_FREE_TEXTURE_MEMORY)
+ {
+ low_mem = true ;
+ }
+ }
+#if 0 //ignore nVidia cards
+ else if (gGLManager.mHasNVXMemInfo)
+ {
+ S32 free_memory;
+ glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &free_memory);
+
+ if(free_memory / 1024 < MIN_FREE_TEXTURE_MEMORY)
+ {
+ low_mem = true ;
+ }
+ }
+#endif
+
+ if(!low_mem) //check main memory, only works for windows.
+ {
+ LLMemory::updateMemoryInfo() ;
+ if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy)
+ {
+ low_mem = true ;
+ }
+ }
+
+ return low_mem ;
+}
+
//static
void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity)
{
@@ -449,6 +491,11 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
sEvaluationTimer.reset();
}
}
+ else if(sEvaluationTimer.getElapsedTimeF32() > discard_delta_time && isMemoryForTextureLow())
+ {
+ sDesiredDiscardBias += discard_bias_delta;
+ sEvaluationTimer.reset();
+ }
else if (sDesiredDiscardBias > 0.0f &&
BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < sMaxBoundTextureMemInMegaBytes * texmem_lower_bound_scale &&
BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < sMaxTotalTextureMemInMegaBytes * texmem_lower_bound_scale)
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index a4a5ae0a5b..b96441127d 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -267,6 +267,7 @@ private:
/*virtual*/ LLImageGL* getGLTexture() const ;
virtual void switchToCachedImage();
+ static bool isMemoryForTextureLow() ;
protected:
LLUUID mID;
S32 mBoostLevel; // enum describing priority level
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 30ef8b8a29..92d2762ef3 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1053,6 +1053,13 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
// Treat any card with < 32 MB (shudder) as having 32 MB
// - it's going to be swapping constantly regardless
S32 max_vram = gGLManager.mVRAM;
+
+ if(gGLManager.mIsATI)
+ {
+ //shrink the availabe vram for ATI cards because some of them do not handel texture swapping well.
+ max_vram *= 0.75f;
+ }
+
max_vram = llmax(max_vram, getMinVideoRamSetting());
max_texmem = max_vram;
if (!get_recommended)