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.cpp100
1 files changed, 67 insertions, 33 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 133b6ee8c9..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;
@@ -1426,22 +1433,28 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/)
//virtual
void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height)
{
- if(mKnownDrawWidth != width || mKnownDrawHeight != height)
+ if(mKnownDrawWidth < width || mKnownDrawHeight < height)
{
- mKnownDrawWidth = width;
- mKnownDrawHeight = height;
+ mKnownDrawWidth = llmax(mKnownDrawWidth, width) ;
+ mKnownDrawHeight = llmax(mKnownDrawHeight, height) ;
mKnownDrawSizeChanged = TRUE ;
mFullyLoaded = FALSE ;
}
- addTextureStats((F32)(width * height));
+ addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight));
}
//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,10 +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
{
- // Leave the priority as-is
- return mDecodePriority;
+ priority = -5.f; //stop fetching
}
}
else if (cur_discard < 0)
@@ -1563,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
{
@@ -1579,12 +1593,12 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
}
else if (!isJustBound() && mCachedRawImageReady)
{
- //if(mBoostLevel < BOOST_HIGH)
- //{
- // // We haven't rendered this in a while, de-prioritize it
- // desired_discard += 2;
- //}
- //else
+ if(mBoostLevel < BOOST_HIGH)
+ {
+ // We haven't rendered this in a while, de-prioritize it
+ desired_discard += 2;
+ }
+ else
{
// We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is
desired_discard = cur_discard;
@@ -1592,7 +1606,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
}
S32 ddiscard = cur_discard - desired_discard;
- ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY);
+ ddiscard = llclamp(ddiscard, -1, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY);
priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR;
}
@@ -1670,7 +1684,11 @@ void LLViewerFetchedTexture::updateVirtualSize()
setAdditionalDecodePriority(facep->getImportanceToCamera()) ;
}
}
- mNeedsResetMaxVirtualSize = TRUE ;
+
+ if(mCanResetMaxVirtualSize)
+ {
+ mNeedsResetMaxVirtualSize = TRUE ;
+ }
reorganizeFaceList() ;
reorganizeVolumeList();
}
@@ -1751,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)
@@ -1887,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)
{
@@ -1899,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,
@@ -2040,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)
@@ -2175,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)
@@ -2262,11 +2290,14 @@ void LLViewerFetchedTexture::destroyRawImage()
{
sRawCount--;
- if(mForceToSaveRawImage)
+ if(mIsRawImageValid)
{
- saveRawImage() ;
- }
- setCachedRawImage() ;
+ if(mForceToSaveRawImage)
+ {
+ saveRawImage() ;
+ }
+ setCachedRawImage() ;
+ }
}
mRawImage = NULL;
@@ -3293,7 +3324,10 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
}
}
- mNeedsResetMaxVirtualSize = TRUE ;
+ if(mCanResetMaxVirtualSize)
+ {
+ mNeedsResetMaxVirtualSize = TRUE ;
+ }
reorganizeFaceList() ;
reorganizeVolumeList();