diff options
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 97 |
1 files changed, 44 insertions, 53 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index ccfedd8881..3106a351e0 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -66,12 +66,6 @@ void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL; S32 LLViewerTextureList::sNumImages = 0; -LLStat LLViewerTextureList::sNumImagesStat("Num Images", TRUE); -LLStat LLViewerTextureList::sNumRawImagesStat("Num Raw Images", TRUE); -LLStat LLViewerTextureList::sGLTexMemStat("GL Texture Mem", TRUE); -LLStat LLViewerTextureList::sGLBoundMemStat("GL Bound Mem", TRUE); -LLStat LLViewerTextureList::sRawMemStat("Raw Image Mem", TRUE); -LLStat LLViewerTextureList::sFormattedMemStat("Formatted Image Mem", TRUE); LLViewerTextureList gTextureList; static LLFastTimer::DeclareTimer FTM_PROCESS_IMAGES("Process Images"); @@ -612,8 +606,8 @@ void LLViewerTextureList::updateImages(F32 max_time) if(gTeleportDisplay) { if(!cleared) - { - clearFetchingRequests(); + { + clearFetchingRequests(); gPipeline.clearRebuildGroups(); cleared = TRUE; } @@ -625,12 +619,15 @@ void LLViewerTextureList::updateImages(F32 max_time) LLAppViewer::getTextureFetch()->setTextureBandwidth(recording.getPerSec(LLStatViewer::TEXTURE_KBIT).value()); - LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages); - LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); - LLViewerStats::getInstance()->mGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); - LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); - LLViewerStats::getInstance()->mRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); - LLViewerStats::getInstance()->mFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); + { + using namespace LLStatViewer; + NUM_IMAGES.sample(sNumImages); + NUM_RAW_IMAGES.sample(LLImageRaw::sRawImageCount); + GL_TEX_MEM.sample(LLImageGL::sGlobalTextureMemory); + GL_BOUND_MEM.sample(LLImageGL::sBoundTextureMemory); + RAW_MEM.sample<LLTrace::Bytes>(LLImageRaw::sGlobalRawMemory); + FORMATTED_MEM.sample<LLTrace::Bytes>(LLImageFormatted::sGlobalFormattedMemory); + } { //loading from fast cache @@ -712,7 +709,7 @@ void LLViewerTextureList::updateImagesDecodePriorities() // Update the decode priority for N images each frame { static const S32 MAX_PRIO_UPDATES = gSavedSettings.getS32("TextureFetchUpdatePriorities"); // default: 32 - const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds) + 1, MAX_PRIO_UPDATES); + const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds.value()) + 1, MAX_PRIO_UPDATES); S32 update_counter = llmin(max_update_count, mUUIDMap.size()); uuid_map_t::iterator iter = mUUIDMap.upper_bound(mLastUpdateUUID); while ((update_counter-- > 0) && !mUUIDMap.empty()) @@ -784,7 +781,7 @@ void LLViewerTextureList::updateImagesDecodePriorities() imagep->setInactive() ; } } - + if (!imagep->isInImageList()) { continue; @@ -807,9 +804,9 @@ void LLViewerTextureList::updateImagesDecodePriorities() imagep->setDecodePriority(decode_priority); mImageList.insert(imagep); } - } } } +} void LLViewerTextureList::setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level) { @@ -946,11 +943,11 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) static const F32 MIN_PRIORITY_THRESHOLD = gSavedSettings.getF32("TextureFetchUpdatePriorityThreshold"); // default: 0.0 static const bool SKIP_LOW_PRIO = gSavedSettings.getBOOL("TextureFetchUpdateSkipLowPriority"); // default: false - size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*MAX_HIGH_PRIO_COUNT*gFrameIntervalSeconds)+1, MAX_HIGH_PRIO_COUNT); + size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*MAX_HIGH_PRIO_COUNT*gFrameIntervalSeconds.value())+1, MAX_HIGH_PRIO_COUNT); max_priority_count = llmin(max_priority_count, mImageList.size()); size_t total_update_count = mUUIDMap.size(); - size_t max_update_count = llmin((S32) (MAX_UPDATE_COUNT*MAX_UPDATE_COUNT*gFrameIntervalSeconds)+1, MAX_UPDATE_COUNT); + size_t max_update_count = llmin((S32) (MAX_UPDATE_COUNT*MAX_UPDATE_COUNT*gFrameIntervalSeconds.value())+1, MAX_UPDATE_COUNT); max_update_count = llmin(max_update_count, total_update_count); // MAX_HIGH_PRIO_COUNT high priority entries @@ -982,8 +979,8 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) if (!SKIP_LOW_PRIO || (SKIP_LOW_PRIO && ((imagep->getDecodePriority() > MIN_PRIORITY_THRESHOLD) || imagep->hasFetcher()))) { entries.push_back(imagep); - update_counter--; - } + update_counter--; + } iter2++; total_update_count--; @@ -1187,7 +1184,7 @@ S32 LLViewerTextureList::getMinVideoRamSetting() { S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); //min texture mem sets to 64M if total physical mem is more than 1.5GB - return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM_IN_MEGA_BYTES ; + return (system_ram > 1500) ? 64 : gMinVideoRam.value() ; } //static @@ -1237,7 +1234,7 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) else max_texmem = llmin(max_texmem, (S32)(system_ram)); - max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES); + max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam.value()); return max_texmem; } @@ -1325,7 +1322,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d { received_size = msg->getReceiveSize() ; } - LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes>(received_size); + LLStatViewer::TEXTURE_KBIT.add<LLTrace::Bytes>(received_size); LLStatViewer::TEXTURE_PACKETS.add(1); U8 codec; @@ -1399,7 +1396,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d received_size = msg->getReceiveSize() ; } - LLStatViewer::TEXTURE_KBIT.add<LLUnits::Bytes>(received_size); + LLStatViewer::TEXTURE_KBIT.add<LLTrace::Bytes>(received_size); LLStatViewer::TEXTURE_PACKETS.add(1); //llprintline("Start decode, image header..."); @@ -1679,49 +1676,43 @@ struct UIImageDeclarations : public LLInitParam::Block<UIImageDeclarations> bool LLUIImageList::initFromFile() { - // construct path to canonical textures.xml in default skin dir - std::string base_file_path = gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "default", "textures", "textures.xml"); + // Look for textures.xml in all the right places. Pass + // constraint=LLDir::ALL_SKINS because we want to overlay textures.xml + // from all the skins directories. + std::vector<std::string> textures_paths = + gDirUtilp->findSkinnedFilenames(LLDir::TEXTURES, "textures.xml", LLDir::ALL_SKINS); + std::vector<std::string>::const_iterator pi(textures_paths.begin()), pend(textures_paths.end()); + if (pi == pend) + { + llwarns << "No textures.xml found in skins directories" << llendl; + return false; + } + // The first (most generic) file gets special validations LLXMLNodePtr root; - - if (!LLXMLNode::parseFile(base_file_path, root, NULL)) + if (!LLXMLNode::parseFile(*pi, root, NULL)) { - llwarns << "Unable to parse UI image list file " << base_file_path << llendl; + llwarns << "Unable to parse UI image list file " << *pi << llendl; return false; } if (!root->hasAttribute("version")) { - llwarns << "No valid version number in UI image list file " << base_file_path << llendl; + llwarns << "No valid version number in UI image list file " << *pi << llendl; return false; } UIImageDeclarations images; LLXUIParser parser; - parser.readXUI(root, images, base_file_path); - - // add components defined in current skin - std::string skin_update_path = gDirUtilp->getSkinDir() - + gDirUtilp->getDirDelimiter() - + "textures" - + gDirUtilp->getDirDelimiter() - + "textures.xml"; + parser.readXUI(root, images, *pi); + + // add components defined in the rest of the skin paths + while (++pi != pend) + { LLXMLNodePtr update_root; - if (skin_update_path != base_file_path - && LLXMLNode::parseFile(skin_update_path, update_root, NULL)) + if (LLXMLNode::parseFile(*pi, update_root, NULL)) { - parser.readXUI(update_root, images, skin_update_path); + parser.readXUI(update_root, images, *pi); } - - // add components defined in user override of current skin - skin_update_path = gDirUtilp->getUserSkinDir() - + gDirUtilp->getDirDelimiter() - + "textures" - + gDirUtilp->getDirDelimiter() - + "textures.xml"; - if (skin_update_path != base_file_path - && LLXMLNode::parseFile(skin_update_path, update_root, NULL)) - { - parser.readXUI(update_root, images, skin_update_path); } if (!images.validateBlock()) return false; |