summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2011-06-15 16:20:33 -0600
committerXiaohong Bao <bao@lindenlab.com>2011-06-15 16:20:33 -0600
commit0bb7bcc96cfea7b5d56f083d0afcbc1fce7e9f21 (patch)
tree46b49b78517bdf835cc5abf503c2c5c730702ced /indra/newview/llviewertexture.cpp
parenta451c9e83431c7d39ef912680bf9d7411c7a12d2 (diff)
fix for SH-1788: Assert in texture load when uploading textured mesh model
and beyond: fixed the thread-safe and highest texture resolution flaws in the mesh texture uploading flow.
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index af06421bf9..4da0f80a00 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1168,6 +1168,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
mSavedRawDiscardLevel = -1 ;
mDesiredSavedRawDiscardLevel = -1 ;
mLastReferencedSavedRawImageTime = 0.0f ;
+ mKeptSavedRawImageTime = 0.f ;
mLastCallBackActiveTime = 0.f;
}
@@ -2696,8 +2697,16 @@ void LLViewerFetchedTexture::saveRawImage()
mLastReferencedSavedRawImageTime = sCurrentTime ;
}
-void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard)
+void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time)
{
+ mKeptSavedRawImageTime = kept_time ;
+ mLastReferencedSavedRawImageTime = sCurrentTime ;
+
+ if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard)
+ {
+ return ; //raw imge is ready.
+ }
+
if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard)
{
mForceToSaveRawImage = TRUE ;
@@ -2713,11 +2722,16 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard)
mRawImage = NULL ;
mRawDiscardLevel = INVALID_DISCARD_LEVEL ;
- }
+ }
}
}
void LLViewerFetchedTexture::destroySavedRawImage()
{
+ if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime)
+ {
+ return ; //keep the saved raw image.
+ }
+
mForceToSaveRawImage = FALSE ;
mSaveRawImage = FALSE ;
@@ -2729,6 +2743,7 @@ void LLViewerFetchedTexture::destroySavedRawImage()
mSavedRawDiscardLevel = -1 ;
mDesiredSavedRawDiscardLevel = -1 ;
mLastReferencedSavedRawImageTime = 0.0f ;
+ mKeptSavedRawImageTime = 0.f ;
}
LLImageRaw* LLViewerFetchedTexture::getSavedRawImage()