summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp66
1 files changed, 49 insertions, 17 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index a5adb11c53..9b5b210bf7 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -492,6 +492,7 @@ void LLViewerTexture::init(bool firstinit)
mTextureState = NO_DELETE ;
mDontDiscard = FALSE;
+ mCanResetMaxVirtualSize = true ;
mMaxVirtualSize = 0.f;
mNeedsGLTexture = FALSE ;
mNeedsResetMaxVirtualSize = FALSE ;
@@ -590,6 +591,11 @@ void LLViewerTexture::forceImmediateUpdate()
{
}
+void LLViewerTexture::setResetMaxVirtualSizeFlag(bool flag)
+{
+ mCanResetMaxVirtualSize = flag ;
+}
+
void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const
{
if(needs_gltexture)
@@ -613,7 +619,7 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co
void LLViewerTexture::resetTextureStats()
{
- mMaxVirtualSize = 0.0f;
+ mMaxVirtualSize = 0.0f ;
mAdditionalDecodePriority = 0.f ;
mNeedsResetMaxVirtualSize = FALSE ;
}
@@ -1071,6 +1077,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
mRequestedDiscardLevel = -1;
mRequestedDownloadPriority = 0.f;
mFullyLoaded = FALSE;
+ mCanUseHTTP = true ;
mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
@@ -1440,8 +1447,14 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height)
//virtual
void LLViewerFetchedTexture::processTextureStats()
{
- if(mFullyLoaded)//already loaded
+ if(mFullyLoaded)
{
+ if(mDesiredDiscardLevel <= mMinDesiredDiscardLevel)//already loaded
+ {
+ return ;
+ }
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ;
+ mFullyLoaded = FALSE ;
return ;
}
@@ -1475,6 +1488,7 @@ void LLViewerFetchedTexture::processTextureStats()
mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2,
log((F32)mFullHeight / mKnownDrawHeight) / log_2) ;
mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ;
+ mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ;
}
mKnownDrawSizeChanged = FALSE ;
@@ -1507,7 +1521,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
}
if(mFullyLoaded && !mForceToSaveRawImage)//already loaded for static texture
{
- return -4.0f ; //alreay fetched
+ return -1.0f ; //alreay fetched
}
S32 cur_discard = getCurrentDiscardLevelForFetching();
@@ -1521,16 +1535,16 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
}
else if(mDesiredDiscardLevel >= cur_discard && cur_discard > -1)
{
- priority = -1.0f ;
+ priority = -2.0f ;
}
else if(mCachedRawDiscardLevel > -1 && mDesiredDiscardLevel >= mCachedRawDiscardLevel)
{
- priority = -1.0f;
+ priority = -3.0f;
}
else if (mDesiredDiscardLevel > getMaxDiscardLevel())
{
// Don't decode anything we don't need
- priority = -1.0f;
+ priority = -4.0f;
}
else if ((mBoostLevel == LLViewerTexture::BOOST_UI || mBoostLevel == LLViewerTexture::BOOST_ICON) && !have_all_data)
{
@@ -1544,9 +1558,14 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
// Always want high boosted images
priority = 1.f;
}
+ else if(mForceToSaveRawImage)
+ {
+ //force to fetch the raw image.
+ priority = 1.f;
+ }
else
{
- priority = -1.f; //stop fetching
+ priority = -5.f; //stop fetching
}
}
else if (cur_discard < 0)
@@ -1562,11 +1581,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel))
{
// larger mips are corrupted
- priority = -3.0f;
- }
- else if (cur_discard <= mDesiredDiscardLevel)
- {
- priority = -4.0f;
+ priority = -6.0f;
}
else
{
@@ -1669,7 +1684,11 @@ void LLViewerFetchedTexture::updateVirtualSize()
setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
}
- mNeedsResetMaxVirtualSize = TRUE ;
+
+ if(mCanResetMaxVirtualSize)
+ {
+ mNeedsResetMaxVirtualSize = TRUE ;
+ }
reorganizeFaceList() ;
reorganizeVolumeList();
}
@@ -1750,7 +1769,7 @@ bool LLViewerFetchedTexture::updateFetch()
else
{
mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
- mFetchPriority, mFetchDeltaTime, mRequestDeltaTime);
+ mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
}
// We may have data ready regardless of whether or not we are finished (e.g. waiting on write)
@@ -1886,11 +1905,17 @@ bool LLViewerFetchedTexture::updateFetch()
h = mGLTexturep->getHeight(0);
c = mComponents;
}
+
+ 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;
fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), decode_priority,
- w, h, c, desired_discard, needsAux());
+ w, h, c, desired_discard, needsAux(), mCanUseHTTP);
if (fetch_request_created)
{
@@ -1898,7 +1923,7 @@ bool LLViewerFetchedTexture::updateFetch()
mIsFetching = TRUE;
mRequestedDiscardLevel = desired_discard;
mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority,
- mFetchPriority, mFetchDeltaTime, mRequestDeltaTime);
+ mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP);
}
// if createRequest() failed, we're finishing up a request for this UUID,
@@ -2039,10 +2064,13 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
bool run_raw_callbacks = false;
bool need_readback = false;
+ mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
iter != mLoadedCallbackList.end(); )
{
LLLoadedCallbackEntry *entryp = *iter++;
+ mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)entryp->mDesiredDiscard) ;
+
if (entryp->mNeedsImageRaw)
{
if (mNeedsAux)
@@ -2174,6 +2202,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
if (mLoadedCallbackList.empty())
{
gTextureList.mCallbackList.erase(this);
+ mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
}
// Done with any raw image data at this point (will be re-created if we still have callbacks)
@@ -3295,7 +3324,10 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
}
}
- mNeedsResetMaxVirtualSize = TRUE ;
+ if(mCanResetMaxVirtualSize)
+ {
+ mNeedsResetMaxVirtualSize = TRUE ;
+ }
reorganizeFaceList() ;
reorganizeVolumeList();