XG texture computer: tail mip positions, 3D tail offsets, and element offsets from the plane's start #3224
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#3224
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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
How this differs from #1659
#1659 (closed) made every tail mip report
OffsetBytes0. The change proposed here is narrower on that point and adds one new part:t.offset. As the review on #1659 showed,main's 2D offsets already point at the right bytes (the tail block is the first block of each slice), so they are left alone.tail_positionfor every tail mip. Today only thick (3D) tail mips fill it; 2D and thin 3D tail mips leave it at 0, which puts each of them at element (0, 0) for a caller that reads the position.element_offset(slot 0x30) counts from the plane's start, whilemip_offset(slot 0x28) keeps adding the plane's offset. Today both add it.Question for the maintainer: would you like this as one pull request, or split, with the
element_offsetpart (which nothing open or closed touches) first and the tail-mip part after it?What the texture computer answers
XGCreateTextureComputerreturns an object the title asks about a texture's layout:GetResourceLayout(slot 0x10) fills oneMipOutper mip. For a mip in the tail (the small mips packed into one block of the surface's mode) it givesin_tail,offsetandtail_position, the mip's element position in the tail block (x in bits 0-10, y in bits 11-21).GetMipLevelOffsetBytes(slot 0x28): where a mip's first element is, from the texture's start.element_offsethere): the byte offset of one element(plane, mip, x, y, z).What was wrong
tail_position. A thin 3D mode placed its tail mips by byte offset, as 2D does, so a 3D tail mip could land in the wrong block: a 3D tail is one block per depth slab, and a mip in it is found by its position, not by an offset into the chain.element_offsetadded the plane's offset to every element. For a two-plane texture (depth then stencil), the stencil plane's elements came back shifted by the whole depth plane.mip_offset(slot 0x28) is where the texture-relative offset belongs, and it keeps it.What the title does with it
The title reads texels of a 128x4
4KB_Stexture on the CPU throughelement_offset(see the comment onelement_offsetincrates/victory-hle/src/modules/xg.rs). An offset that includes a plane offset it does not expect sends that read to the wrong bytes. A 3D tail mip placed by offset instead of by position is uploaded to, or read from, the wrong block.How to check
cargo test -p victory-hle xg: three new CPU tests (no GPU, no game data):three_d_tail_mips_are_placed_by_position: a 64x64x64 RGBA8 texture with a full chain inSW_4KB_SandSW_64KB_S(thick) andSW_64KB_Z_XandSW_64KB_R_X(thin): every tail mip has offset 0 and the layout's tail position.two_d_tail_mips_name_their_position: a 256x256 BC7 texture inSW_64KB_D: each of its 8 tail mips keeps its byte offset and names its position.element_offsets_count_from_the_plane: a D24S8 texture (depth, then stencil): the stencil plane's first element is at 0 from its plane, andmip_offsetfor that plane equals the plane's offset.Please test on your cards
Our run is on one RTX 4090 in one scene. If you can, run a session with the branch on your own card, Series X or S, and say whether anything looks different (volume textures seen from far away, where their small mips are used, are the likeliest place) and whether the frame times change. Our run was unattended and measured frame times only, not pictures.
@github-actions[bot] on GitHub · 2026-11-29 20:48 UTC · original
Please attach both logs from the run that went wrong. Without them we can only guess. Paste
%LOCALAPPDATA%into the address bar of File Explorer to get there.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
@dyshay on GitHub · 2026-11-29 21:39 UTC · original
Not a crash report: this is a development issue (a code change and how to test it). The relevant log lines and the numbers from our runs are quoted in the issue body, and the pull request linked here has the tests.