aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r--linden/indra/newview/llviewerimagelist.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp
index a79a76a..f6b1688 100644
--- a/linden/indra/newview/llviewerimagelist.cpp
+++ b/linden/indra/newview/llviewerimagelist.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -89,7 +89,8 @@ LLStat LLViewerImageList::sFormattedMemStat(32, TRUE);
89LLViewerImageList::LLViewerImageList() 89LLViewerImageList::LLViewerImageList()
90 : mForceResetTextureStats(FALSE), 90 : mForceResetTextureStats(FALSE),
91 mUpdateStats(FALSE), 91 mUpdateStats(FALSE),
92 mMaxResidentTexMem(0) 92 mMaxResidentTexMem(0),
93 mMaxTotalTextureMem(0)
93{ 94{
94} 95}
95 96
@@ -97,6 +98,7 @@ void LLViewerImageList::init()
97{ 98{
98 sNumImages = 0; 99 sNumImages = 0;
99 mMaxResidentTexMem = 0; 100 mMaxResidentTexMem = 0;
101 mMaxTotalTextureMem = 0 ;
100 102
101 if (gNoRender) 103 if (gNoRender)
102 { 104 {
@@ -498,10 +500,10 @@ void LLViewerImageList::updateImages(F32 max_time)
498{ 500{
499 sNumImagesStat.addValue(sNumImages); 501 sNumImagesStat.addValue(sNumImages);
500 sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); 502 sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
501 sGLTexMemStat.addValue(LLImageGL::sGlobalTextureMemory/(1024.f*1024.f)); 503 sGLTexMemStat.addValue((F32)(LLImageGL::sGlobalTextureMemory >> 20));
502 sGLBoundMemStat.addValue(LLImageGL::sBoundTextureMemory/(1024.f*1024.f)); 504 sGLBoundMemStat.addValue((F32)(LLImageGL::sBoundTextureMemory >> 20));
503 sRawMemStat.addValue(LLImageRaw::sGlobalRawMemory/(1024.f*1024.f)); 505 sRawMemStat.addValue((F32)(LLImageRaw::sGlobalRawMemory >> 20));
504 sFormattedMemStat.addValue(LLImageFormatted::sGlobalFormattedMemory/(1024.f*1024.f)); 506 sFormattedMemStat.addValue((F32)(LLImageFormatted::sGlobalFormattedMemory >> 20));
505 507
506 updateImagesDecodePriorities(); 508 updateImagesDecodePriorities();
507 max_time -= updateImagesFetchTextures(max_time); 509 max_time -= updateImagesFetchTextures(max_time);
@@ -586,9 +588,12 @@ void LLViewerImageList::updateImagesDecodePriorities()
586 588
587 imagep->processTextureStats(); 589 imagep->processTextureStats();
588 F32 old_priority = imagep->getDecodePriority(); 590 F32 old_priority = imagep->getDecodePriority();
591 F32 old_priority_test = llmax(old_priority, 0.0f);
589 F32 decode_priority = imagep->calcDecodePriority(); 592 F32 decode_priority = imagep->calcDecodePriority();
593 F32 decode_priority_test = llmax(decode_priority, 0.0f);
590 // Ignore < 20% difference 594 // Ignore < 20% difference
591 if ((decode_priority < old_priority * .8f || decode_priority > old_priority * 1.25f)) 595 if ((decode_priority_test < old_priority_test * .8f) ||
596 (decode_priority_test > old_priority_test * 1.25f))
592 { 597 {
593 removeImageFromList(imagep); 598 removeImageFromList(imagep);
594 imagep->setDecodePriority(decode_priority); 599 imagep->setDecodePriority(decode_priority);
@@ -918,12 +923,14 @@ LLPointer<LLImageJ2C> LLViewerImageList::convertToUploadFile(LLPointer<LLImageRa
918} 923}
919 924
920const S32 MIN_VIDEO_RAM = 32; 925const S32 MIN_VIDEO_RAM = 32;
921const S32 MAX_VIDEO_RAM = 2048; 926const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons.
922 927
923// Returns min setting for TextureMemory (in MB) 928// Returns min setting for TextureMemory (in MB)
924S32 LLViewerImageList::getMinVideoRamSetting() 929S32 LLViewerImageList::getMinVideoRamSetting()
925{ 930{
926 return MIN_VIDEO_RAM; 931 S32 system_ram = (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20);
932 //min texture mem sets to 64M if total physical mem is more than 1.5GB
933 return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM;
927} 934}
928 935
929//static 936//static
@@ -956,8 +963,8 @@ S32 LLViewerImageList::getMaxVideoRamSetting(bool get_recommended)
956 max_texmem = llmin(max_texmem, (S32)(system_ram/2)); 963 max_texmem = llmin(max_texmem, (S32)(system_ram/2));
957 else 964 else
958 max_texmem = llmin(max_texmem, (S32)(system_ram)); 965 max_texmem = llmin(max_texmem, (S32)(system_ram));
959 966
960 max_texmem = llclamp(max_texmem, MIN_VIDEO_RAM, MAX_VIDEO_RAM); 967 max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM);
961 968
962 return max_texmem; 969 return max_texmem;
963} 970}
@@ -994,7 +1001,18 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem)
994 1001
995 S32 vb_mem = mem; 1002 S32 vb_mem = mem;
996 S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); 1003 S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4);
997 mMaxResidentTexMem = (vb_mem - fb_mem)<<20; 1004 mMaxResidentTexMem = (vb_mem - fb_mem) ; //in MB
1005
1006 mMaxTotalTextureMem = mMaxResidentTexMem * 2;
1007 if (mMaxResidentTexMem > 640)
1008 {
1009 mMaxTotalTextureMem -= (mMaxResidentTexMem >> 2);
1010 }
1011
1012 if (mMaxTotalTextureMem > (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20) - 128)
1013 {
1014 mMaxTotalTextureMem = (gSysMemory.getPhysicalMemoryClamped() >> 20) - 128 ;
1015 }
998 1016
999 llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; 1017 llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl;
1000 llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl; 1018 llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl;