From c66065b6885bd8f0b3a3321cff4e7ae5919d38e3 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sun, 28 Aug 2011 01:04:30 -0500 Subject: [PATCH] CachedControl cleanup in random places. LL's ctor format is supported, so using such in LL code to ease diffs. --- indra/newview/app_settings/settings.xml | 35 ++++++++++++++++++++++++- indra/newview/lltexturefetch.cpp | 29 ++++++++++---------- indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewertexture.cpp | 13 +++++---- indra/newview/llviewertexture.h | 1 - indra/newview/llviewertexturelist.cpp | 4 +-- indra/newview/llvovolume.cpp | 6 +++-- 7 files changed, 61 insertions(+), 29 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index aed9e91c0..b17c3185b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7613,7 +7613,7 @@ Value 0 - LogMessages + LogMessages Comment Log network traffic @@ -7624,6 +7624,17 @@ Value 0 + LogTextureNetworkTraffic + + Comment + Log network traffic for textures + Persist + 1 + Type + Boolean + Value + 0 + LoginAsGod Comment @@ -12720,6 +12731,28 @@ Value 0 + TextureDisable + + Comment + If TRUE, do not load textures for in-world content + Persist + 1 + Type + Boolean + Value + 0 + + TextureDiscardLevel + + Comment + Specify texture resolution (0 = highest, 5 = lowest) + Persist + 1 + Type + U32 + Value + 0 + TextureLoadFullRes Comment diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index d5e094b0f..a72d6b5e0 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -308,9 +308,9 @@ public: const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - static LLCachedControl log_to_viewer_log("LogTextureDownloadsToViewerLog",false); - static LLCachedControl log_to_sim("LogTextureDownloadsToSimulator",false); - static bool log_texture_traffic = false; + static LLCachedControl log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + static LLCachedControl log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ; if (log_to_viewer_log || log_to_sim) { @@ -661,7 +661,6 @@ public: * Corresponds to LLTextureFetch::commandSendMetrics() */ -#if HTTP_METRICS class TFReqSendMetrics : public LLTextureFetch::TFRequest { public: @@ -705,7 +704,6 @@ public: const LLUUID mAgentID; LLViewerAssetStats * mMainStats; }; -#endif /* * Examines the merged viewer metrics report and if found to be too long, @@ -1131,7 +1129,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == LOAD_FROM_NETWORK) { - static const LLCachedControl use_http("ImagePipelineUseHTTP", false); + static LLCachedControl use_http(gSavedSettings,"ImagePipelineUseHTTP"); // if (mHost != LLHost::invalid) use_http = false; if (use_http && mCanUseHTTP && mUrl.empty()) // get http url. @@ -1486,7 +1484,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == DECODE_IMAGE) { - static LLCachedControl textures_decode_disabled("TextureDecodeDisabled", false); + static LLCachedControl textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled"); if(textures_decode_disabled) { // for debug use, don't decode @@ -2360,12 +2358,13 @@ void LLTextureFetch::commonUpdate() //virtual S32 LLTextureFetch::update(U32 max_time_ms) { + static LLCachedControl band_width(gSavedSettings,"ThrottleBandwidthKBPS"); + { mNetworkQueueMutex.lock() ; - static const LLCachedControl max_bandwidth("ThrottleBandwidthKBPS", 2000); - mMaxBandwidth = max_bandwidth; - - gTextureList.sTextureBits += mHTTPTextureBits; + mMaxBandwidth = band_width ; + + gTextureList.sTextureBits += mHTTPTextureBits ; mHTTPTextureBits = 0 ; mNetworkQueueMutex.unlock() ; @@ -2567,8 +2566,8 @@ void LLTextureFetch::sendRequestListToSimulators() // llinfos << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard // << " Packet: " << packet << " Priority: " << req->mImagePriority << llendl; - static LLCachedControl log_to_viewer_log("LogTextureDownloadsToViewerLog",false); - static LLCachedControl log_to_sim("LogTextureDownloadsToSimulator",false); + static LLCachedControl log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); if (log_to_viewer_log || log_to_sim) { mTextureInfo.setRequestStartTime(req->mID, LLTimer::getTotalTime()); @@ -2789,8 +2788,8 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 if(packet_num >= (worker->mTotalPackets - 1)) { - static LLCachedControl log_to_viewer_log("LogTextureDownloadsToViewerLog",false); - static LLCachedControl log_to_sim("LogTextureDownloadsToSimulator",false); + static LLCachedControl log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); if (log_to_viewer_log || log_to_sim) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 49bc8d04a..beecf1558 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1542,7 +1542,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) item = new LLMenuItemCheckGL("Animate Textures", menu_toggle_control, NULL, menu_check_control, (void*)"AnimateTextures"); menu->append(item); - item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_variable, NULL, menu_check_variable, (void*)&LLViewerTexture::sDontLoadVolumeTextures); + item = new LLMenuItemCheckGL("Disable Textures", menu_toggle_control, NULL, menu_check_control, (void*)"TextureDisable"); menu->append(item); item = new LLMenuItemCheckGL("HTTP Get Textures", menu_toggle_control, NULL, menu_check_control, (void*)"ImagePipelineUseHTTP"); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 687f746cd..527ede3a2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -104,7 +104,6 @@ S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA ; BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE ; F32 LLViewerTexture::sCurrentTime = 0.0f ; //BOOL LLViewerTexture::sUseTextureAtlas = FALSE ; -BOOL LLViewerTexture::sDontLoadVolumeTextures = FALSE ; const F32 desired_discard_bias_min = -2.0f; // -max number of levels to improve image quality by const F32 desired_discard_bias_max = (F32)MAX_DISCARD_LEVEL; // max number of levels to reduce image quality by @@ -1537,7 +1536,7 @@ void LLViewerFetchedTexture::processTextureStats() { updateVirtualSize() ; - static LLCachedControl textures_fullres("TextureLoadFullRes",false); + static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes"); if (textures_fullres) { @@ -1825,7 +1824,7 @@ S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching() bool LLViewerFetchedTexture::updateFetch() { - static LLCachedControl textures_decode_disabled("TextureDecodeDisabled",false); + static LLCachedControl textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled"); if(textures_decode_disabled) { return false ; @@ -2027,11 +2026,11 @@ bool LLViewerFetchedTexture::updateFetch() c = mComponents; } - /*const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); + const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); if (override_tex_discard_level != 0) { desired_discard = override_tex_discard_level; - }*/ + } // bypass texturefetch directly by pulling from LLTextureCache bool fetch_request_created = false; @@ -3014,8 +3013,8 @@ BOOL LLViewerLODTexture::isUpdateFrozen() void LLViewerLODTexture::processTextureStats() { updateVirtualSize() ; - - static LLCachedControl textures_fullres("TextureLoadFullRes", false); + + static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes"); if (textures_fullres) { diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index ad59d37c8..6488b2fc6 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -336,7 +336,6 @@ public: static BOOL sFreezeImageScalingDown ;//do not scale down image res if set. static F32 sCurrentTime ; //static BOOL sUseTextureAtlas ; - static BOOL sDontLoadVolumeTextures ; static LLPointer sNullImagep; // Null texture for non-textured objects. }; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 5297e2d7c..a42c481b6 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1188,7 +1188,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) // static void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_data) { - static LLCachedControl log_texture_traffic("LogTextureNetworkTraffic",false) ; + static LLCachedControl log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ; LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES); @@ -1260,7 +1260,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d // static void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_data) { - static LLCachedControl log_texture_traffic("LogTextureNetworkTraffic",FALSE) ; + static LLCachedControl log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ; LLMemType mt1(LLMemType::MTYPE_APPFMTIMAGE); LLFastTimer t(LLFastTimer::FTM_PROCESS_IMAGES); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 090376f4b..77cd91454 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -502,8 +502,10 @@ void LLVOVolume::updateTextureVirtualSize() { return; } - - if (LLViewerTexture::sDontLoadVolumeTextures || LLAppViewer::getTextureFetch()->mDebugPause) + + static LLCachedControl dont_load_textures(gSavedSettings,"TextureDisable"); + + if (dont_load_textures || LLAppViewer::getTextureFetch()->mDebugPause) // || !mDrawable->isVisible()) { return; }