Skip to content

Interleave rigged and world alpha draw calls back-to-front (port of secondlife/viewer#5927) - #26

Merged
anne-skydancer merged 1 commit into
masterfrom
interleaved-alpha
Sep 4, 2026
Merged

anne-skydancer merged 1 commit into
masterfrom
interleaved-alpha

Conversation

@anne-skydancer

Copy link
Copy Markdown
Owner

Summary

Port of secondlife/viewer#5927 (by Viscerous). Replaces the two-phase alpha render (rigged attachments drawn in an earlier separate batch) with a single back-to-front interleaved pass that merges rigged-attachment and world alpha streams. This fixes incorrect draw ordering where rigged alpha objects render behind world-alpha geometry they should be in front of (and vice versa) — e.g. alpha hair/clothing on avatars sorting wrongly against world alpha surfaces.

Changes (9 files, +346/−36)

  • llspatialpartition.hLLSpatialGroup::worldAlphaDepth()/mAvatarDepth for cross-stream depth ordering; CompareWorldAlphaDepth + CompareDepthRenderOrder comparators (std::less for pointer tie-breaks)
  • pipeline.{cpp,h}EAlphaStream {WORLD, RIGGED, INTERLEAVED}; LLPipeline::canUseInterleavedAlpha() + sortAlphaGroupsForInterleaving(); bridge stamp fan-out in postSort
  • llvoavatar.{cpp,h} + llcontrolavatar.cppLLVOAvatar::calcRiggedAlphaDepth() stamps rigged alpha groups with the avatar's depth
  • lldrawpoolalpha.{cpp,h}renderAlpha walks both streams in one interleaved pass via dual iterators; per-group LLGLDepthTest (stamped rigged groups depth-write, unstamped blend-only)
  • app_settings/settings.xmlRenderInterleavedAlpha setting, default on, as an escape hatch

Ported following FS preserve-original conventions (// <FS> ... // </FS> comment blocks).

Test plan

  • Builds clean: ReleaseFS_open, 0 errors, 0 warnings (vulkanstorm-bin.exe linked)
  • Static analysis: no diagnostics on any touched file; settings.xml parses
  • Runtime resources staged (settings/skins/fonts/character/fs_resources/mesa)
  • In-world visual verification of alpha ordering (avatar alpha attachments vs world alpha surfaces)

Notes

  • Default on per prior discussion; RenderInterleavedAlpha remains as a runtime toggle if issues surface.
  • Original work by Viscerous — secondlife/viewer PR #5927.

…econdlife/viewer#5927)

Port of SLL PR #5927 (Viscerous): single back-to-front alpha pass that merges
rigged-attachment and world alpha streams instead of rendering rigged alpha
in a separate earlier batch. Fixes incorrect draw ordering where rigged alpha
objects render behind world alpha they should be in front of (and vice versa).

- LLSpatialGroup: worldAlphaDepth()/mAvatarDepth for cross-stream ordering
- CompareWorldAlphaDepth + CompareDepthRenderOrder comparators
- EAlphaStream {WORLD, RIGGED, INTERLEAVED}
- LLPipeline::canUseInterleavedAlpha()/sortAlphaGroupsForInterleaving()
- LLVOAvatar::calcRiggedAlphaDepth() stamps rigged alpha groups with avatar depth
- LLDrawPoolAlpha::renderAlpha walks both streams in one interleaved pass;
  per-group LLGLDepthTest (stamped rigged groups depth-write, unstamped blend-only)
- RenderInterleavedAlpha setting (default on) as escape hatch

Original work by Viscerous (secondlife/viewer PR #5927). Ported with
// <FS> ... // </FS> preserve-original conventions.
@github-actions github-actions Bot added the c/cpp label Sep 4, 2026
@anne-skydancer

Copy link
Copy Markdown
Owner Author

Validated in-world on Windows (RX 9070 XT): no issues observed. Visuals as expected, no alpha artifacts — rigged avatar attachments and world alpha surfaces sort correctly.

@anne-skydancer
anne-skydancer merged commit 11c921a into master Sep 4, 2026
8 of 10 checks passed
@anne-skydancer
anne-skydancer deleted the interleaved-alpha branch September 4, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant