XG: preserve packed mip swizzle/positions and fix array subresource tiling (fixes #2400) #2404
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2404
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2404"
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?
@pushkarreddyy on GitHub · 2026-11-25 13:02 UTC · original
pushkarreddyy:fix/xg-packed-mip-array-tiling→main· +104 −25 · 1 files · 1 commits · openFixes #2400.
Root Cause
crates/victory-hle/src/modules/xg.rs,mip_out):mip_out()replaced the parent texture's swizzle mode withtail_swizzle(l.desc.swizzle)for tail mips and only populatedtail_positionwhenl.thick(3D) was true, leaving 2D packed-miptail_positionunset.crates/victory-hle/src/modules/xg.rs,tiling):tiling()clamped array slices with packed mips tol.slices.min(2), indexed subresources bystandardinstead ofc.mips, and zeroed all entries past slice 0 instead of preserving the full[0..c.mips * l.slices)subresource index space and zeroing only packed mip entries.Implementation Details
mip_out(): Preservesl.desc.swizzle.0for packed tail mips (removing the now-unusedtail_swizzlehelper) and setsout.tail_position = t.x | (t.y << 11)for both 2D and 3D layouts.tiling(): Computestotal = c.mips * l.slicesandentries = total.saturating_sub(first).min(*n), maps each index(first + i)to(slice, mip) = (idx / c.mips, idx % c.mips), writes zeroedSubresourceTilingentries whenmip >= standard, writes valid tiling metadata whenmip < standard, and returns the count of standard mip entries in*n.Verification
packed_mip_preserves_swizzle_and_array_tiling_indexes_slicesincrates/victory-hle/src/modules/xg.rscovering:p.mips[2].swizzle == p.mips[0].swizzle == 10) on packed mips.first = 0,n = 8): verifies returned standard count (std_mips + 1 = 2), zeroed packed slots (1..7), populated slice 1 mip 0 at index7, and untouched sentinel entries beyond the requested window.layout_and_copies_through_the_objecttest remains green.Scope & Limitations
victory-formatslayout calculation are unchanged.@LooperSalty(AnyXboxX) and@FunWithFlagsDevfor identifying and documenting these corrections.@pushkarreddyy on GitHub · 2026-11-25 13:36 UTC · original
Hi @Marvisak — this PR resolves #2400 (packed mip swizzle/2D
tail_positionpreservation and array subresource tiling indexing across all slices), with regression tests passing and CI (check) green ona8af897. Ready for review and merge whenever convenient!@pushkarreddyy on GitHub · 2026-11-25 14:19 UTC · original
If any testers on untested GPU/OS setups (NVIDIA, AMD RDNA2/RDNA3/RDNA4, Windows 10/11, or Wine/Proton) can verify
a8af897in-title for packed-mip and array-texture tiling, feedback is welcome!AI-assisted: yes (Gemini 4 Neon)
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 14:33 UTC · original
I checked a nonzero subresource window through the XG texture computer on Windows. The synthetic BC7 texture has three array slices and seven mips. The test requests 12 entries starting at subresource 12, inside the second slice's packed tail.
On main
940d32f69b, the call returns zero standard mips. Ona8af8975d8, it returns one standard mip at output index 2 with start tile 5. The eight packed entries are zero. The three entries beyond the resource retain their sentinels, as does the entire output of a query starting at subresource 21.All six XG tests and all 145 Windows HLE tests passed. Strict HLE Clippy and staged asset policy passed. The test-only commit 57e8198 is directly on your head.
Please keep the Git author if cherry-picking. If you fold the test into another commit, please add:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
@Marvisak on GitHub · 2026-11-25 15:30 UTC · original
Automated triage for the maintainers.
Needs work (evidence). This changes values the XG emulation returns to the title, in
crates/victory-hle/src/modules/xg.rs: inmip_out, packed tail mips keep the parent's swizzle mode instead oftail_swizzle, andtail_positionis set for 2D mips too; intiling, subresources are indexed by total mips over every slice and packed entries are zeroed. The doc comment ontilinginmainsays deliberately that with a tail the console's library lists two slices at most and zeroes all but the first; this PR reverses that without updating the comment, and the only evidence is that another fork does it this way.Please add evidence for both changes: output from the real library for the same descriptions (swizzle,
tail_position, and the tiling array with its count for a 3-slice packed texture), or the title's own use of these values, and update thetilingdoc comment. Since the code comes from another contributor's fork, please keep that author on the commit (or add aCo-authored-byline). CI: passing.Generated by Claude Code
a8af8975d8to07585828da@pushkarreddyy on GitHub · 2026-11-26 15:07 UTC · original
Updated in
0758582(rebased ontomain63bcca4):tilingdoc comment incrates/victory-hle/src/modules/xg.rsto match the full subresource index space across all slices and packed-mip zeroing.Co-authored-byattribution for@LooperSaltyand@andrewpozdnakov7-jpg, and included the nonzero-offset window regression check (first = 12,n = 12) inpacked_mip_preserves_swizzle_and_array_tiling_indexes_slices.Testers on untested Windows 10/11, NVIDIA, AMD, and Wine/Proton setups (or with native
xg_xs.dllcomparisons) are welcome to verify0758582!AI-assisted: yes (Gemini 4 Neon)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.