aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.cpp
diff options
context:
space:
mode:
authorArmin Weatherwax2010-09-07 13:41:02 +0200
committerArmin Weatherwax2010-09-23 15:42:40 +0200
commit087e15e89930d51c3964329befb273ae3b2d330d (patch)
tree684c49a772b0097ed88a25660e1fd3dd10b264cc /linden/indra/newview/llviewerimagelist.cpp
parentRobin Cornelius: fixes for building plugins on Linux 64bit (diff)
downloadmeta-impy-087e15e89930d51c3964329befb273ae3b2d330d.zip
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.gz
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.bz2
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.xz
port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimagelist.cpp50
1 files changed, 22 insertions, 28 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp
index 29c630b..f795de6 100644
--- a/linden/indra/newview/llviewerimagelist.cpp
+++ b/linden/indra/newview/llviewerimagelist.cpp
@@ -199,7 +199,6 @@ static std::string get_texture_list_name()
199 199
200void LLViewerImageList::doPrefetchImages() 200void LLViewerImageList::doPrefetchImages()
201{ 201{
202#if 1
203 if (LLAppViewer::instance()->getPurgeCache()) 202 if (LLAppViewer::instance()->getPurgeCache())
204 { 203 {
205 // cache was purged, no point 204 // cache was purged, no point
@@ -227,7 +226,7 @@ void LLViewerImageList::doPrefetchImages()
227 image->addTextureStats((F32)pixel_area); 226 image->addTextureStats((F32)pixel_area);
228 } 227 }
229 } 228 }
230#endif 229
231 230
232} 231}
233 232
@@ -486,7 +485,7 @@ void LLViewerImageList::removeImageFromList(LLViewerImage *image)
486 { 485 {
487 llinfos << "Image is not in mUUIDMap!" << llendl ; 486 llinfos << "Image is not in mUUIDMap!" << llendl ;
488 } 487 }
489 llerrs << "LLViewerImageList::removeImageFromList - Image not in list" << llendl; 488 llwarns << "LLViewerImageList::removeImageFromList - Image not in list" << llendl;
490 } 489 }
491 llverify(mImageList.erase(image) == 1); 490 llverify(mImageList.erase(image) == 1);
492 image->mInImageList = FALSE; 491 image->mInImageList = FALSE;
@@ -535,7 +534,8 @@ void LLViewerImageList::deleteImage(LLViewerImage *image)
535 534
536void LLViewerImageList::dirtyImage(LLViewerImage *image) 535void LLViewerImageList::dirtyImage(LLViewerImage *image)
537{ 536{
538 mDirtyTextureList.insert(image); 537 //mDirtyTextureList.insert(image);
538 image->invalidateAtlas(TRUE) ; // KL
539} 539}
540 540
541//////////////////////////////////////////////////////////////////////////// 541////////////////////////////////////////////////////////////////////////////
@@ -547,25 +547,21 @@ void LLViewerImageList::updateImages(F32 max_time)
547 547
548 sNumImagesStat.addValue(sNumImages); 548 sNumImagesStat.addValue(sNumImages);
549 sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); 549 sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount);
550 sGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); 550 sGLTexMemStat.addValue((F32)(LLImageGL::sGlobalTextureMemoryInBytes >> 20));
551 sGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); 551 sGLBoundMemStat.addValue((F32)(LLImageGL::sBoundTextureMemoryInBytes >> 20));
552 sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); 552 sRawMemStat.addValue((F32)(LLImageRaw::sGlobalRawMemory >> 20));
553 sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); 553 sFormattedMemStat.addValue((F32)(LLImageFormatted::sGlobalFormattedMemory >> 20));
554 554
555 llpushcallstacks ; 555 llpushcallstacks ;
556
557 updateImagesDecodePriorities(); 556 updateImagesDecodePriorities();
558
559 llpushcallstacks ; 557 llpushcallstacks ;
560 F32 total_max_time = max_time;
561 max_time -= updateImagesFetchTextures(max_time); 558 max_time -= updateImagesFetchTextures(max_time);
562
563 llpushcallstacks ; 559 llpushcallstacks ;
564 max_time = llmax(max_time, total_max_time*.25f); // at least 25% of max_time 560 max_time = llmin(llmax(max_time, 0.001f*10.f*gFrameIntervalSeconds), 0.001f);
565 max_time -= updateImagesCreateTextures(max_time); 561 max_time -= updateImagesCreateTextures(max_time);
566
567 llpushcallstacks ; 562 llpushcallstacks ;
568 563 max_time = llmin(llmax(max_time, 0.001f*10.f*gFrameIntervalSeconds), 0.001f);
564 llpushcallstacks ;
569 if (!mDirtyTextureList.empty()) 565 if (!mDirtyTextureList.empty())
570 { 566 {
571 LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY); 567 LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY);
@@ -739,7 +735,7 @@ F32 LLViewerImageList::updateImagesCreateTextures(F32 max_time)
739 return create_timer.getElapsedTimeF32(); 735 return create_timer.getElapsedTimeF32();
740} 736}
741 737
742void LLViewerImageList::bumpToMaxDecodePriority(LLViewerImage* imagep) 738void LLViewerImageList::forceImmediateUpdate(LLViewerImage* imagep)
743{ 739{
744 if(!imagep) 740 if(!imagep)
745 { 741 {
@@ -747,11 +743,6 @@ void LLViewerImageList::bumpToMaxDecodePriority(LLViewerImage* imagep)
747 } 743 }
748 if(imagep->mInImageList) 744 if(imagep->mInImageList)
749 { 745 {
750 if (imagep->getDecodePriority() == LLViewerImage::maxDecodePriority())
751 {
752 // Already at maximum.
753 return;
754 }
755 removeImageFromList(imagep); 746 removeImageFromList(imagep);
756 } 747 }
757 748
@@ -1028,13 +1019,16 @@ LLPointer<LLImageJ2C> LLViewerImageList::convertToUploadFile(LLPointer<LLImageRa
1028 1019
1029 return compressedImage; 1020 return compressedImage;
1030} 1021}
1022
1023const S32 MIN_VIDEO_RAM = 32;
1024const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons.
1031 1025
1032// Returns min setting for TextureMemory (in MB) 1026// Returns min setting for TextureMemory (in MB)
1033S32 LLViewerImageList::getMinVideoRamSetting() 1027S32 LLViewerImageList::getMinVideoRamSetting()
1034{ 1028{
1035 S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); 1029 S32 system_ram = (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20);
1036 //min texture mem sets to 64M if total physical mem is more than 1.5GB 1030 //min texture mem sets to 64M if total physical mem is more than 1.5GB
1037 return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM_IN_MEGA_BYTES ; 1031 return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM;
1038} 1032}
1039 1033
1040//static 1034//static
@@ -1061,14 +1055,14 @@ S32 LLViewerImageList::getMaxVideoRamSetting(bool get_recommended)
1061 llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl; 1055 llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl;
1062 } 1056 }
1063 1057
1064 S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB 1058 S32 system_ram = (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20); // In MB
1065 //llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl; 1059 //llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl;
1066 if (get_recommended) 1060 if (get_recommended)
1067 max_texmem = llmin(max_texmem, (S32)(system_ram/2)); 1061 max_texmem = llmin(max_texmem, (S32)(system_ram/2));
1068 else 1062 else
1069 max_texmem = llmin(max_texmem, (S32)(system_ram)); 1063 max_texmem = llmin(max_texmem, (S32)(system_ram));
1070 1064
1071 max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES); 1065 max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM);
1072 1066
1073 return max_texmem; 1067 return max_texmem;
1074} 1068}
@@ -1113,9 +1107,9 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem)
1113 mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2); 1107 mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2);
1114 } 1108 }
1115 1109
1116 if (mMaxTotalTextureMemInMegaBytes > (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()) - 128) 1110 if (mMaxTotalTextureMemInMegaBytes > (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20) - 128)
1117 { 1111 {
1118 mMaxTotalTextureMemInMegaBytes = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()) - 128 ; 1112 mMaxTotalTextureMemInMegaBytes = (gSysMemory.getPhysicalMemoryClamped() >> 20) - 128 ;
1119 } 1113 }
1120 1114
1121 llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; 1115 llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl;