Texture streaming rework#5829
Open
Geenz wants to merge 5 commits into
Open
Conversation
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.
…oser to the camera.
akleshchev
reviewed
May 18, 2026
| auto iter = sTextureAllocs.find(texName); | ||
| if (iter != sTextureAllocs.end()) | ||
| { | ||
| iter->second += size; |
Contributor
There was a problem hiding this comment.
I take it something substructs the old value? Where does it happen?
akleshchev
reviewed
May 18, 2026
akleshchev
reviewed
May 18, 2026
| desired_discard = llmin(desired_discard, getMaxDiscardLevel()); | ||
| // Clamp the fetch request to what the codestream encodes; deeper | ||
| // discards are served from the GL mip pyramid via scaleDown. | ||
| desired_discard = llmin(desired_discard, (S32)mCodecMaxDiscardLevel); |
Contributor
There was a problem hiding this comment.
This might need to be conditional.
Ex: Some texture (profile icons) get intentionally requested at max resolution and then scaled down (icons) to a reasonable size. Some textures aren't JPEG2000 and don't discard well.
Collaborator
Author
There was a problem hiding this comment.
Good point - and FWIW the discards now better relate to how they work on the GPU with mip levels and such. I'll go ahead and add some guard rails to make sure profile images and similar (like picks) don't get accidentally downrez'd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks the texture streaming system for more consistent signal composition and better VRAM accounting.