XG: every tail mip names its position, 3D tail mips are placed by it, element offsets count from the plane #3225
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!3225
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3225"
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?
@dyshay on GitHub · 2026-11-29 20:48 UTC · original
pr/xg-tail-and-element-offsets→main· +104 −10 · 1 files · 1 commits · closed without mergingFixes #3224
What it changes
All in
crates/victory-hle/src/modules/xg.rs:tail_position(x bits 0-10, y bits 11-21), not only thick ones. Before, 2D and thin 3D tail mips left it at 0, which puts all of them at element (0, 0) for a caller that reads it.t.offset, which already names the right bytes (the tail block is the first block of each slice).element_offset(slot 0x30) counts from the plane's start. For a depth+stencil texture, the stencil plane's elements came back shifted by the whole depth plane.mip_offset(slot 0x28) still includes the plane's offset. The title reads texels of a 128x44KB_Stexture on the CPU throughelement_offset(see the comment there); an offset it does not expect makes it read the wrong bytes.element_offset,texel_coordinateandmip_offsetnow say which start each offset counts from.No switch: it is a correctness fix, pinned by tests.
How it was tested
cargo testpassed for the crates it touches: yes, for the XG tests (cargo test -p victory-hle xg): 55 passed, 0 failed, including three new CPU tests (no GPU, no game data):three_d_tail_mips_are_placed_by_position: a 64x64x64 RGBA8 texture, full chain, inSW_4KB_SandSW_64KB_S(thick) andSW_64KB_Z_XandSW_64KB_R_X(thin): every tail mip reports offset 0 and its layout's tail position.two_d_tail_mips_name_their_position: a 256x256 BC7 texture inSW_64KB_D: its 8 tail mips keep their byte offsets and name their positions.element_offsets_count_from_the_plane: a linear D24S8 texture: the stencil plane's first element is at 0 from its plane, further elements step by its pitch, andmip_offsetfor that plane equals the plane's offset.cargo clippy -p victory-hle --all-targets --locked: nothing inxg.rs. (With-D warningsthe build stops first on warnings already onmaininvictory-loader,victory-shaderandvictory-gpu, andvictory-hlehas its existing ones ingameinput.rsandlifecycle.rs.)Checked for overlap
element_offsetpart), #902 (merged, related: tail mips report the surface's swizzle mode).Provenance
Ported from dyshay/Janus fb2bd08 (ours).
AI-assisted: written with Claude Code; reviewed and tested as described above.
🤖 Generated with Claude Code
Pull request closed