From e65852e9a58ec92763b88369f53092628ab7a6b8 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 3 May 2012 11:38:05 -0600 Subject: For SH-3086: add functions to refetch all previous textures through HTTP and from cache --- indra/newview/llviewertexture.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index ea329f6aac..684d1afa4f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1266,6 +1266,8 @@ void LLViewerFetchedTexture::init(bool firstinit) mLastReferencedSavedRawImageTime = 0.0f ; mKeptSavedRawImageTime = 0.f ; mLastCallBackActiveTime = 0.f; + + mInDebug = FALSE; } LLViewerFetchedTexture::~LLViewerFetchedTexture() @@ -1898,6 +1900,20 @@ S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching() return current_discard ; } +bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) +{ + if(debug_level < 0) + { + mInDebug = FALSE; + return false; + } + mInDebug = TRUE; + + mDesiredDiscardLevel = debug_level; + + return true; +} + bool LLViewerFetchedTexture::updateFetch() { static LLCachedControl textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled"); -- cgit v1.2.3 From 0afca8603a56205df4c4e310387651726cbfbe3c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 4 May 2012 18:16:37 -0600 Subject: fix crashes and flaws for SH-3086 --- indra/newview/llviewertexture.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 684d1afa4f..511fc13973 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -409,7 +409,11 @@ void LLViewerTextureManager::cleanup() void LLViewerTexture::initClass() { LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture() ; - sTexelPixelRatio = gSavedSettings.getF32("TexelPixelRatio"); + + if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) + { + sTexelPixelRatio = gSavedSettings.getF32("TexelPixelRatio"); + } } // static @@ -2168,7 +2172,10 @@ bool LLViewerFetchedTexture::updateFetch() void LLViewerFetchedTexture::clearFetchedResults() { - llassert_always(!mNeedsCreateTexture && !mIsFetching); + if(mNeedsCreateTexture || mIsFetching) + { + return ; + } cleanup(); destroyGLTexture(); -- cgit v1.2.3 From 957bfcd5d90b4ae0dfccd7a934364461059f8402 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 29 May 2012 18:02:11 -0600 Subject: fo SH-3074: clear ghost and stale texture fetching requests in time. --- indra/newview/llviewertexture.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 511fc13973..a6f4b10540 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1240,7 +1240,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mIsMissingAsset = FALSE; mLoadedCallbackDesiredDiscardLevel = S8_MAX; - mPauseLoadedCallBacks = TRUE ; + mPauseLoadedCallBacks = FALSE ; mNeedsCreateTexture = FALSE; @@ -2072,6 +2072,10 @@ bool LLViewerFetchedTexture::updateFetch() { make_request = false; } + else if(mDesiredDiscardLevel > getMaxDiscardLevel()) + { + make_request = false; + } else if (mNeedsCreateTexture || mIsMissingAsset) { make_request = false; @@ -2190,11 +2194,13 @@ void LLViewerFetchedTexture::forceToDeleteRequest() { if (mHasFetcher) { - LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); mHasFetcher = FALSE; mIsFetching = FALSE ; - resetTextureStats(); } + + resetTextureStats(); + + mDesiredDiscardLevel = getMaxDiscardLevel() + 1; } void LLViewerFetchedTexture::setIsMissingAsset() @@ -2237,10 +2243,18 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ; } - if(mPauseLoadedCallBacks && !pause) + if(mPauseLoadedCallBacks) { - unpauseLoadedCallbacks(src_callback_list) ; + if(!pause) + { + unpauseLoadedCallbacks(src_callback_list) ; + } } + else if(pause) + { + pauseLoadedCallbacks(src_callback_list) ; + } + LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause); mLoadedCallbackList.push_back(entryp); -- cgit v1.2.3 From f25dbddd5b3d5fcc271db81b91f777f60c497832 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 31 May 2012 18:10:32 -0600 Subject: fix for MAINT-1113: [PUBLIC_JIRA_USERS][crashhunters] crash at LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *) [secondlife-bin llviewertexturelist.cpp] --- indra/newview/llviewertexture.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a6f4b10540..ad7e50b788 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1842,8 +1842,6 @@ F32 LLViewerFetchedTexture::maxDecodePriority() void LLViewerFetchedTexture::setDecodePriority(F32 priority) { - llassert(!mInImageList); - mDecodePriority = priority; if(mDecodePriority < F_ALMOST_ZERO) -- cgit v1.2.3 From 0d80aced2477500ed5912a34e2bc4b6dbf8f719a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 12 Jun 2012 17:01:48 -0600 Subject: for SH-3073: implement a fast cache system for texture fetching --- indra/newview/llviewertexture.cpp | 46 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index ad7e50b788..1226c98f1c 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -62,6 +62,7 @@ #include "llmediaentry.h" #include "llvovolume.h" #include "llviewermedia.h" +#include "lltexturecache.h" /////////////////////////////////////////////////////////////////////////////// // statics @@ -1257,6 +1258,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mRequestDeltaTime = 0.f; mForSculpt = FALSE ; mIsFetched = FALSE ; + mInFastCacheList = FALSE; mCachedRawImage = NULL ; mCachedRawDiscardLevel = -1 ; @@ -1313,7 +1315,38 @@ void LLViewerFetchedTexture::cleanup() mCachedRawDiscardLevel = -1 ; mCachedRawImageReady = FALSE ; mSavedRawImage = NULL ; - mSavedRawDiscardLevel = -1; +} + +//access the fast cache +void LLViewerFetchedTexture::loadFromFastCache() +{ + if(!mInFastCacheList) + { + return; //no need to access the fast cache. + } + mInFastCacheList = FALSE; + + mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel) ; + if(mRawImage.notNull()) + { + mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; + mFullHeight = mRawImage->getHeight() << mRawDiscardLevel; + setTexelsPerImage(); + + if(mFullWidth > MAX_IMAGE_SIZE || mFullHeight > MAX_IMAGE_SIZE) + { + //discard all oversized textures. + destroyRawImage(); + setIsMissingAsset(); + mRawDiscardLevel = INVALID_DISCARD_LEVEL ; + } + else + { + mRequestedDiscardLevel = mDesiredDiscardLevel + 1; + mIsRawImageValid = TRUE; + addToCreateTexture() ; + } + } } void LLViewerFetchedTexture::setForSculpt() @@ -1741,7 +1774,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired; ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; - setAdditionalDecodePriority(1.0f) ;//boost the textures without any data so far. + setAdditionalDecodePriority(0.1f) ;//boost the textures without any data so far. } else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel)) { @@ -1953,6 +1986,10 @@ bool LLViewerFetchedTexture::updateFetch() { return false; // process any raw image data in callbacks before replacing } + if(mInFastCacheList) + { + return false; + } S32 current_discard = getCurrentDiscardLevelForFetching() ; S32 desired_discard = getDesiredDiscardLevel(); @@ -2082,6 +2119,11 @@ bool LLViewerFetchedTexture::updateFetch() { make_request = false; } + else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel)) + { + make_request = false; + switchToCachedImage() ; //use the cached raw data first + } //else if (!isJustBound() && mCachedRawImageReady) //{ // make_request = false; -- cgit v1.2.3 From 0730b24d7cb0a0ce0d6d08bc4e98387124bf03d0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 26 Jun 2012 22:27:24 -0600 Subject: fix merge conflicts: v-r to drano --- indra/newview/llviewertexture.cpp | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 73f7d0d7ee..077056b66a 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -410,15 +410,11 @@ void LLViewerTextureManager::cleanup() void LLViewerTexture::initClass() { LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture() ; -<<<<<<< local if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) { sTexelPixelRatio = gSavedSettings.getF32("TexelPixelRatio"); } -======= - sTexelPixelRatio = gSavedSettings.getF32("TexelPixelRatio"); ->>>>>>> other } // static @@ -2221,14 +2217,10 @@ bool LLViewerFetchedTexture::updateFetch() void LLViewerFetchedTexture::clearFetchedResults() { -<<<<<<< local if(mNeedsCreateTexture || mIsFetching) { return ; } -======= - llassert_always(!mNeedsCreateTexture && !mIsFetching); ->>>>>>> other cleanup(); destroyGLTexture(); @@ -2243,24 +2235,13 @@ void LLViewerFetchedTexture::forceToDeleteRequest() { if (mHasFetcher) { -<<<<<<< local -======= - LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); ->>>>>>> other mHasFetcher = FALSE; mIsFetching = FALSE ; -<<<<<<< local -======= - resetTextureStats(); ->>>>>>> other } -<<<<<<< local resetTextureStats(); mDesiredDiscardLevel = getMaxDiscardLevel() + 1; -======= ->>>>>>> other } void LLViewerFetchedTexture::setIsMissingAsset() -- cgit v1.2.3 From d99e867284f4d908e9ee86544726c66719e11e3f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 6 Jul 2012 16:36:12 -0600 Subject: fix for MAINT-1201: 404 errors appear in the log when opening the world map --- indra/newview/llviewertexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 7f638a24bf..e1eb54bd24 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2182,7 +2182,8 @@ void LLViewerFetchedTexture::setIsMissingAsset() } else { - llwarns << mUrl << ": Marking image as missing" << llendl; + //it is normal no map tile on an empty region. + //llwarns << mUrl << ": Marking image as missing" << llendl; } if (mHasFetcher) { -- cgit v1.2.3 From 0660f646e11e9b9afacd228ad43bd31c8c555ad7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Jul 2012 17:54:38 -0600 Subject: fix for SH-3237: cached sculpties do not load at the correct LOD. --- indra/newview/llviewertexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 077056b66a..27415270e6 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1355,9 +1355,10 @@ void LLViewerFetchedTexture::setForSculpt() static const S32 MAX_INTERVAL = 8 ; //frames mForSculpt = TRUE ; - if(isForSculptOnly() && !getBoundRecently()) + if(isForSculptOnly() && hasGLTexture() && !getBoundRecently()) { destroyGLTexture() ; //sculpt image does not need gl texture. + mTextureState = ACTIVE; } checkCachedRawSculptImage() ; setMaxVirtualSizeResetInterval(MAX_INTERVAL) ; -- cgit v1.2.3