Texture layouts: mips in the tail report the surface's swizzle mode, as they are addressed #902
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!902
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-902"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@wildheathen on GitHub · 2026-11-28 08:52 UTC · original
wildheathen:xg-tail-swizzle→main· +5 −13 · 1 files · 1 commits · merged 2026-11-28 19:39 UTCChange
XGCreateTextureComputer's layout reported the mips in the tail in a 256-byte mode (SW_256B_S,SW_256B_D, or 3 for the render modes) while every mip above the tail reported the surface's own mode. Now every mip reports the surface's mode.Why
A mip tail is not a separate surface: the small mips sit inside one block of the surface's own swizzle mode, at fixed positions within it (addrlib's
GetMipTailDimand the mip tail offsets inComputeSurfaceAddrFromCoordMacroTiled).Layout::offsetalready addresses them that way:rowandcolumnshift the coordinate by the mip's tail position and apply the surface's pattern. The computer's output told a caller the opposite, so anything computing addresses from a mip's mode would use a pattern the data is not stored in.Impact
None visible today, as far as we know: the title reads offsets 0x00, 0x08, 0x10 and 0x1c of each mip (see the comment on
MipOut), not the mode. This makes the layout agree with the addresses the same object gives.Tests
layout_and_copies_through_the_objectnow also checks that all 9 mips of a 256x256 BC7 texture inSW_64KB_D(8 of them in the tail) report mode 10.cargo test -p victory-hle --lib modules::xg: 23 passed.victory-hle: nothing in the changed lines (the two existing warnings are inshadow.rsandgameinput.rs).Not run with the game.
@Dukestar69 on GitHub · 2026-11-28 09:33 UTC · original · approved these changes
Tested locally merged onto
main(63b902f).crates/victory-hle/src/modules/xg.rs;cargo xtask policypassed (294 files ok).cargo test -p victory-hle --lib xg::passed (4 passed; 0 failed).cargo test -p victory-formats --lib texture::passed (22 passed; 0 failed).Consistent swizzle-mode reporting for tail mips matching actual addressing. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).