summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturefetch.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2026-05-12 20:23:44 -0400
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2026-05-12 20:23:44 -0400
commit82db4943e011fc65e9a0b87990abb49b898a7782 (patch)
treec7a16b81c6d681db2277cc95b875968206cb0509 /indra/newview/lltexturefetch.cpp
parent5d5c74c27f7354dba499acb3534c64a9a7fa3dc7 (diff)
Rework texture streaming and tracking.
This is a big one: - Reworks the discard signal almost entirely. Now has a normalized 0..1 discard signal: distance x size x channel exponent, floored by staleness and background app state. Shaped by VRAM pressure. - Textures can now scale down to the smallest GPU mip (1×1), independent of the codec's encoded mip count. - Terrain texture LOD now works. Useful for 2K textures and PBR on terrain. Based upon camera distance to nearest terrain patch. - New texture quality setting. Low/Medium/High/Ultra - Caps texture resolution on Low to 1024, and otherwise shifts the discard signal around. Makes distance based texture LOD work a lot more predictably. - We now track last bind state for textures, and discard accordingly. We progressively discard based upon last bind time. - Avatar textures get a residency boost to stay loaded in VRAM longer under pressure.
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r--indra/newview/lltexturefetch.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 51ade60827..574c200eb4 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -542,6 +542,7 @@ private:
S32 mRequestedDiscard;
S32 mLoadedDiscard;
S32 mDecodedDiscard;
+ S32 mCodecLevels = 0;
LLFrameTimer mRequestedDeltaTimer;
LLFrameTimer mFetchDeltaTimer;
LLTimer mCacheReadTimer;
@@ -1843,6 +1844,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
else
{
llassert_always(mRawImage.notNull());
+ if (mFormattedImage.notNull())
+ {
+ mCodecLevels = (S32)mFormattedImage->getLevels();
+ }
LL_DEBUGS(LOG_TXT) << mID << ": Decoded. Discard: " << mDecodedDiscard
<< " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL;
setState(WRITE_TO_CACHE);
@@ -2774,10 +2779,12 @@ LLTextureFetchWorker* LLTextureFetch::getWorker(const LLUUID& id)
// Threads: T*
bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, S32& worker_state,
LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux,
- LLCore::HttpStatus& last_http_get_status)
+ LLCore::HttpStatus& last_http_get_status,
+ S32& codec_levels)
{
LL_PROFILE_ZONE_SCOPED;
bool res = false;
+ codec_levels = 0;
LLTextureFetchWorker* worker = getWorker(id);
if (worker)
{
@@ -2809,6 +2816,9 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, S3
discard_level = worker->mDecodedDiscard;
raw = worker->mRawImage;
aux = worker->mAuxImage;
+ // Cached on the worker so the value survives mFormattedImage
+ // clears (cache-retry, decode-abort, write-to-cache complete).
+ codec_levels = worker->mCodecLevels;
decode_time = worker->mDecodeTime;
fetch_time = worker->mFetchTime;