summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-10-08 15:23:47 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-10-08 15:23:47 -0600
commitf20fadeafab79b940da7addecd21de2f0962ced5 (patch)
tree92e95c651f2fb1b7680f0e22d7751fe61fdfbe74
parentb0c85e250d28351743e32af21b040868867cec27 (diff)
fix a texture issue that unpaused callbacks never get fired.
-rwxr-xr-xindra/newview/llviewertexture.cpp19
-rwxr-xr-xindra/newview/llviewertexture.h3
2 files changed, 15 insertions, 7 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 831551a0a7..5330c4da86 100755
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1046,7 +1046,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
mLastReferencedSavedRawImageTime = 0.0f ;
mKeptSavedRawImageTime = 0.f ;
mLastCallBackActiveTime = 0.f;
-
+ mForceCallbackFetch = FALSE;
mInDebug = FALSE;
mFTType = FTT_UNKNOWN;
@@ -2281,6 +2281,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry:
}
mPauseLoadedCallBacks = FALSE ;
mLastCallBackActiveTime = sCurrentTime ;
+ mForceCallbackFetch = TRUE;
if(need_raw)
{
mSaveRawImage = TRUE ;
@@ -2321,6 +2322,7 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s
bool LLViewerFetchedTexture::doLoadedCallbacks()
{
static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds
+ static const F32 MAX_IDLE_WAIT_TIME = 5.f ; //seconds
if (mNeedsCreateTexture)
{
@@ -2525,6 +2527,9 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
}
}
+ // Done with any raw image data at this point (will be re-created if we still have callbacks)
+ destroyRawImage();
+
//
// If we have no callbacks, take us off of the image callback list.
//
@@ -2532,10 +2537,13 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
{
gTextureList.mCallbackList.erase(this);
}
+ else if(!res && mForceCallbackFetch && sCurrentTime - mLastCallBackActiveTime > MAX_IDLE_WAIT_TIME && !mIsFetching)
+ {
+ //wait for long enough but no fetching request issued, force one.
+ forceToRefetchTexture(mLoadedCallbackDesiredDiscardLevel, 5.f);
+ mForceCallbackFetch = FALSE; //fire once.
+ }
- // Done with any raw image data at this point (will be re-created if we still have callbacks)
- destroyRawImage();
-
return res;
}
@@ -2774,9 +2782,8 @@ void LLViewerFetchedTexture::saveRawImage()
}
//force to refetch the texture to the discard level
-void LLViewerFetchedTexture::forceToRefetchTexture(S32 desired_discard)
+void LLViewerFetchedTexture::forceToRefetchTexture(S32 desired_discard, F32 kept_time)
{
- F32 kept_time = 60.0; //seconds
if(mForceToSaveRawImage)
{
desired_discard = llmin(desired_discard, mDesiredSavedRawDiscardLevel);
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 31430c31e0..7e45fcaf4b 100755
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -388,7 +388,7 @@ public:
BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;}
BOOL isRawImageValid()const { return mIsRawImageValid ; }
void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ;
- void forceToRefetchTexture(S32 desired_discard = 0);
+ void forceToRefetchTexture(S32 desired_discard = 0, F32 kept_time = 60.f);
/*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
void destroySavedRawImage() ;
LLImageRaw* getSavedRawImage() ;
@@ -423,6 +423,7 @@ private:
BOOL mFullyLoaded;
BOOL mInDebug;
BOOL mInFastCacheList;
+ BOOL mForceCallbackFetch;
protected:
std::string mLocalFileName;