summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml13
-rw-r--r--indra/newview/lltexturefetch.cpp9
-rw-r--r--indra/newview/llviewertexture.cpp5
-rw-r--r--indra/newview/llviewertexturelist.cpp15
4 files changed, 38 insertions, 4 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 1ea08498c5..f0ba6eff95 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7808,7 +7808,18 @@
<key>RenderLowMemMinDiscardIncrement</key>
<map>
<key>Comment</key>
- <string>Minimum increment of discard level if system memory gets low</string>
+ <string>Minimum increment of discard bias if available texture memory gets low</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.1</real>
+ </map>
+ <key>RenderHighMemMinDiscardDecrement</key>
+ <map>
+ <key>Comment</key>
+ <string>Minimum decrement of discard bias if excess texture memory is available</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 703030b978..bac0c736b1 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1761,7 +1761,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
mRawImage = NULL;
mAuxImage = NULL;
llassert_always(mFormattedImage.notNull());
- S32 discard = mHaveAllData ? 0 : mLoadedDiscard;
+
+ // if we have the entire image data (and the image is not J2C), decode the full res image
+ // DO NOT decode a higher res j2c than was requested. This is a waste of time and memory.
+ S32 discard = mHaveAllData && mFormattedImage->getCodec() != IMG_CODEC_J2C ? 0 : mLoadedDiscard;
mDecoded = false;
setState(DECODE_IMAGE_UPDATE);
LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard
@@ -2318,6 +2321,10 @@ void LLTextureFetchWorker::callbackDecoded(bool success, const std::string &erro
mRawImage = raw;
mAuxImage = aux;
mDecodedDiscard = mFormattedImage->getDiscardLevel();
+ if (mDecodedDiscard < mDesiredDiscard)
+ {
+ LL_WARNS_ONCE(LOG_TXT) << "Decoded higher resolution than requested" << LL_ENDL;
+ }
LL_DEBUGS(LOG_TXT) << mID << ": Decode Finished. Discard: " << mDecodedDiscard
<< " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index e14ddc4360..14647d6f84 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -559,7 +559,10 @@ void LLViewerTexture::updateClass()
// lower discard bias over time when free memory is available
if (sDesiredDiscardBias > 1.f && over_pct < 0.f)
{
- sDesiredDiscardBias -= gFrameIntervalSeconds * 0.01f;
+ static LLCachedControl<F32> high_mem_discard_decrement(gSavedSettings, "RenderHighMemMinDiscardDecrement", .1f);
+
+ F32 decrement = high_mem_discard_decrement - llmin(over_pct, 0.f);
+ sDesiredDiscardBias -= decrement * gFrameIntervalSeconds;
}
}
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index b44bedea50..0b79c2d8e0 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1066,13 +1066,26 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
{
LLViewerFetchedTexture* imagep = mCreateTextureList.front();
llassert(imagep->mCreatePending);
- imagep->createTexture();
+
+ // desired discard may change while an image is being decoded. If the texture in VRAM is sufficient
+ // for the current desired discard level, skip the texture creation. This happens more often than it probably
+ // should
+ bool redundant_load = imagep->hasGLTexture() && imagep->getDiscardLevel() <= imagep->getDesiredDiscardLevel();
+
+ if (!redundant_load)
+ {
+ imagep->createTexture();
+ }
+
imagep->postCreateTexture();
imagep->mCreatePending = false;
mCreateTextureList.pop();
if (imagep->hasGLTexture() && imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel())
{
+ // NOTE: this may happen if the desired discard reduces while a decode is in progress and does not
+ // necessarily indicate a problem, but if log occurrences excede that of dsiplay_stats: FPS,
+ // something has probably gone wrong.
LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL;
imagep->scaleDown();
}