xg_xs: lay out console textures and serve the texture computer (RT-XG-TEXTURE-COMPUTER) #461
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!461
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/461/head"
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?
@oscarlosu-lab on GitHub · 2026-11-24 05:42 UTC · original
oscarlosu-lab:pr/xg-texture-computer→main· +1418 −93 · 4 files · 1 commits · merged 2026-11-25 02:33 UTCClaimed in the coordination issue as: RT-XG-TEXTURE-COMPUTER
Summary
Implements the console texture layout model and
XGCreateTextureComputer/XGSuggestSwizzleModeinruntime/shims/xg_xs.cppon top of a GFX10 texture layout model (runtime/src/console_texture_layout.h), replacing the previousE_NOTIMPLstubs:0(AddRef),1(Release),2(layout structure),6(element offsets),8(copy into subresource),9(copy from subresource), and10(64 KiB tiling), while unsupported slots log once and returnE_NOTIMPL.*outalongsideE_INVALIDARG(preserving compatibility with measured callers that ignore theHRESULT).E_NOTIMPL).Attribution
Marvisak/VIctory(GPL-3.0),crates/victory-formats/src/texture.rsandcrates/victory-hle/src/modules/xg.rsatd2a4bae1f, credited in the file headers; AMDaddrlibMIT notice preserved.Verification
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo --target gta6rt xg_xs_test) on Windows 11, MSVC 19.52 x64 (VS 2026): 0 warnings in the touched files.xg_xs_test.exe:106 checks, 0 failures(hand-checked addresses, mip tails, two-plane depth-stencil, bijection/round-trip across 10 layouts, and shim slot routing).ctest -R xg_xs:1/1 Test #50: xg_xs ... Passed (0.19 sec).python -I scripts/check_no_game_data.py&python -I tests/test_docs_links.py: PASS (16/16 OK).AI-assisted. No game files.
@VibeClauding on GitHub · 2026-11-24 08:45 UTC · original
Cross-check of this PR's layout model against an independently written one, with no game files:
runtime/src/console_texture_layout.hhere againstsrc/gfx10_layout.hfrom Impre-visible/Leonida116979c49f(Librett0's model, built from the measureddocs/textures.mdrule rather than ported from VIctory).3,038 2D cases: modes linear, 256B_S/D, 4KB_S/D, 64KB_S/D; element sizes 1-16 bytes and 4x4 blocks of 8 and 16 bytes; 11 extents from 1x1 to 1920x1080 including odd ones (100x37, 3x1024, 1000x600); 1 and 3 slices; 1, 3 and full mip chains. Compared: total size, slice size, and the byte offset of every element of every mip and slice (every 7th row and column above 512).
gfx10addrlib.cppGfx10Lib::HwlComputeSurfaceInfoLinearwalksfor (i = numMipLevels - 1; i >= 0; i--)and accumulatessliceSize, so mip 0 is last: this PR is right.dim()halves texels rounding down (the D3D12 subresource size the title's linear rows have) and keeps addrlib's rounded-uppadded_dim()for placement only; the other model uses the rounded-up extent for the data too (100x37 mip 1: 50x18 here, 50x19 there), which would make its copies read and write one row or column more than the title's rows. This PR's split is the safer one.Also consistent with this PR: xcl's issue 662 (RX 9070 XT, retail title) measured that the title calls slot 9 with one argument more than VIctory's original
xg.rsassumed, a zero/sample word before the tiled pointer, then row pitch and slice pitch (low 32 bits).copy_fromhere already takes(linear, plane, subresource, sample, tiled, row, depth), which is that order.The harness is a 150-line standalone C++20 program including both headers, compiled with MSVC 19.44. I can attach it if useful. AI-assisted.
@DesertGamer on GitHub · 2026-11-24 13:56 UTC · original
Retail check of the texture computer on a second native-Windows machine, which also shows that the title really calls it. Windows 11, RTX 5070, driver 617.14,
LEONIDA_D3D12=vulkan, own 1.0.2.1 copy.Stack without this pull request:
main21625bca8+ #641 + #427 + #727 (the rebased #219) + #602 + #387 + #357 + #432, which reaches the frame loop (400,154PresentX okin 200 s, #641). On that stack the title calls, before the loop,XGSuggestSwizzleMode,XGCreateTextureComputerand texture computer slots 8 and 10, and the shim answers each with theno console texture layout on the PC; E_NOTIMPLline (four lines, one per call site).The same stack with this pull request merged on top (clean merge): 464,933
PresentX okand 16,802,252 D3D12 calls in 200 s, no exception, and in a second 45 s run with stderr kept there is not oneno console texture layoutline and noxg_xsline at all, so the title reached no slot the shim still refuses. The frame loop is reached as before; I make no claim about the frames, which are still black on this stack.What I did not check:
xg_xs_test(the unit target) on my side; whether the layouts the title asks for are right (nothing here compares a texture byte for byte); runs past 200 s.AI-assisted: yes (Claude Code, Sonnet 5.5)
@SweatierKey on GitHub · 2026-11-24 16:00 UTC · original · approved these changes
Independent verification on Windows 11 against
origin/main@1504c1af6:xg_xs_test.exe(clang-cl+ xwin SDK 10.0.26100) and ran natively on Windows 11:106 checks, 0 failures(rc=0), including layout/offset/copy/tiling checks and stub-computer compatibility for unmodelled descriptions.python3 -I scripts/check_no_game_data.py: clean.AI-assisted: yes
@oscarlosu-lab on GitHub · 2026-11-24 18:16 UTC · original
Overlap note: #984 (RT-PROTON-STORY-LOAD, the integration branch that boots through the story load) carries its own
runtime/shims/xg_xs.cppwithxg_xs_layout.h, also from AMD addrlib's GFX10 rules and cross-checked against Marvisak/VIctory'sxg.rs. The two touch the same file and serve the same slots, so they will conflict.I have no preference for which one stays. If #984 is carved into smaller PRs and its texture computer goes in, I'll close this one; if this one goes in first, its layout model and
xg_xs_test(106 checks: hand-checked addresses, mip tails, depth-stencil planes, a bijection and round trip over ten layouts) are there for #984's to be compared against. On an RTX 3060 under #984 the texture computer path logged no errors through the story load.@x2Tweek on GitHub · 2026-11-24 22:50 UTC · original · edited 2026-11-24 23:00 UTC
Windows result for this PR on the frame-loop stack of #321 (head
e0d4fd2b8with three small local changes: thebuild_runtime.ps1fix, #526's window commit and a compile-progress display; own 1.0.2.1 copy, MSVC, NVIDIA RTX 5090, driver 621.24, Windows 11,LEONIDA_D3D12=vulkan, 3-minute runs, counts only).Baseline, #321 alone: every frame has two of its three command lists refused (
ExecuteCommandLists failed: unknown resource, 136 refusals in 70 frames).With this PR's commit (71e2cb90b) cherry-picked on that base, two runs gave 0 and 22 refusals, so on its own it does not remove them every time. With #489 added on top (de191a941), the run had 0 refusals, 68
ExecuteCommandListsok and 0 failed, about 97DrawInstancedcalls and 34 presents.The picture does not change: the seven frames dumped in that last run (
LEONIDA_PRESENT_DUMP, every 5th frame) are entirely RGBA 0,0,0,0 (transparent black), as without this PR. So the refusals are removed or reduced, but the next blocker is elsewhere in what the title draws or presents.AI-assisted.