Skip to content

Texture streaming rework#5829

Open
Geenz wants to merge 5 commits into
release/26.3from
geenz/texture-quality
Open

Texture streaming rework#5829
Geenz wants to merge 5 commits into
release/26.3from
geenz/texture-quality

Conversation

@Geenz
Copy link
Copy Markdown
Collaborator

@Geenz Geenz commented May 18, 2026

Reworks the texture streaming system for more consistent signal composition and better VRAM accounting.

  • Discard is now driven by a normalized 0..1 signal: distance x on-screen-size x per-channel exponent, with staleness / background / VRAM-pressure floors layered on top. Close textures stay less aggressively downrezzed than far ones at every pressure level
  • Post-decode textures can downrez down to 1x1, independent of the j2c's encoded mip count.
  • Terrain LOD now participates in streaming (was pinned to discard 0). Distance is sourced from the closest visible patch each frame.
  • Per-texture last-bind time drives a progressive staleness floor that downrezzes long-idle textures.
  • Backgrounded windows ramp a global discard floor over time, capped at (dim_max - TextureBackgroundDiscardOffset) so some baseline quality survives.
  • Close-camera bubble: textures within TextureCloseBubbleMeters of the camera get dist_factor = 0; the ramp to 1 spans (bubble, draw_distance).
  • New RenderTextureQuality preset (Low/Medium/High/Ultra) drives texture cap + per-channel exponents.
  • Per-channel exponents are now four individual F32 debug settings (TextureChannelNormal/BaseColor/Specular/Emissive) instead of a Vector4

Geenz added 5 commits April 29, 2026 18:03
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.
auto iter = sTextureAllocs.find(texName);
if (iter != sTextureAllocs.end())
{
iter->second += size;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it something substructs the old value? Where does it happen?

Comment thread indra/newview/app_settings/settings.xml
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);
Copy link
Copy Markdown
Contributor

@akleshchev akleshchev May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants