Skip to content

xg_xs: the texture computer's slot 10 answers GetResourceTiling for its description (RT-5) - #8763

Closed
Cresceda wants to merge 1 commit into
ProjectLeonida:mainfrom
Cresceda:xg_xs/texture-computer-get-resource-tiling
Closed

Cresceda wants to merge 1 commit into
ProjectLeonida:mainfrom
Cresceda:xg_xs/texture-computer-get-resource-tiling

Conversation

@Cresceda

Copy link
Copy Markdown

The retail executable calls the xg_xs.dll texture computer's slot 10 with the arguments of ID3D12Device::GetResourceTiling, without the resource: zeroed 4- and 12-byte outputs, a count of 16, first 0 and an array, measured at its one call site. It then adds the packed mip info's standard and packed counts. The shim answered E_NOTIMPL, so the title read 0 mips.

What changes, in runtime/shims/xg_xs.cpp:

  • XGCreateTextureComputer keeps the description it is given. Its first 52 bytes are a D3D12_RESOURCE_DESC (measured at the game's call sites under gta6rt --run): dimension, 4 KiB alignment, width, height, array size, mips, DXGI format, sample count, the console layout word in Layout and console bits in Flags.
  • Slot 10 answers the PC device's 64 KiB tiling of that description, from src/resource_tiling.h: the same rules as the Vulkan layer's GetResourceTiling, through a small table of DXGI element sizes. A description it can't tile keeps the old answer, E_NOTIMPL with nothing written.
  • Computers are still never freed (no site calls AddRef, and one stores the computer for later), so there is one per distinct description, kept for the run.

Unchanged: XGCreateTextureComputer still returns E_NOTIMPL (two callers check it), and slots 2 and 8 still answer E_NOTIMPL without writing. Slot 8 is a copy into the title's own memory, which on the PC isn't the GPU texture.

What it does and doesn't fix: in the retail boot (Windows 11, RTX 4070 SUPER, NVIDIA 616.56, Ryzen 7 5700X3D, own 1.0.2.1 copy, with the boot-chain stack in #8554), slot 10 is now answered and the title's mip counts are the description's. The boot's current stop, a memset through a bad destination about 23 s in, is not this; it happens with or without the change.

Tested: xg_xs_test, 24 checks: the measured 256 x 128 R8_UNORM description (one tile, one standard mip, the 256 x 256 8-bit tile shape); a full RGBA8 chain from its second subresource, compared with src/resource_tiling.h; one computer per description; and the old checks for a description it can't tile. The new checks fail on main, where slot 10 is E_NOTIMPL. scripts/check_no_game_data.py passes on both files.

Claimed on #8683.

Depends on: none.

No game data. AI-assisted (Claude Code).

🤖 Generated with Claude Code

…ts description

The retail executable calls the texture computer's slot 10 with the arguments of ID3D12Device::GetResourceTiling
without the resource (measured at its one call site: zeroed 4- and 12-byte outputs, a count of 16, first 0 and an
array), then adds the packed mip info's standard and packed counts. The shim answered E_NOTIMPL, so the title read
0 mips.

XGCreateTextureComputer now keeps the description it is given. Its first 52 bytes are a D3D12_RESOURCE_DESC
(measured at the game's call sites under gta6rt --run: dimension, 4 KiB alignment, width, height, array size, mips,
DXGI format, sample count, the console layout word and console flag bits). Slot 10 answers the PC device's 64 KiB
tiling of it, from src/resource_tiling.h, the same rules as the Vulkan layer's GetResourceTiling, through a small
table of DXGI element sizes. A description it cannot tile keeps the old answer, E_NOTIMPL with nothing written.

Computers are still never freed (no site calls AddRef, and one stores the computer for later), so there is one per
distinct description, kept for the run. XGCreateTextureComputer still returns E_NOTIMPL, and slots 2 and 8 are
unchanged.

xg_xs_test: the measured 256 x 128 R8_UNORM description (one tile, one standard mip, the 256 x 256 8-bit tile
shape), a full RGBA8 chain from its second subresource against src/resource_tiling.h, and one computer per
description. 24 checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lohant27-netizen

Copy link
Copy Markdown

Tested 32fb9d2e9 on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged onto main 867d922f0 together with #8777, #8763, #8762, #8754, #8711 and #8695 (no conflicts): pass.

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified head 32fb9d2e9 merged onto main (867d922f0) on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo):

  • python -I scripts/check_no_game_data.py on both changed files: clean (exit 0)
  • cmake --build runtime/build --target xg_xs_test --parallel: built cleanly
  • ctest --test-dir runtime/build -R xg_xs --output-on-failure -V: 1/1 passed (24 checks, 0 failures)

AI-assisted.

@Marukooh

Copy link
Copy Markdown
Contributor

checked: 32fb9d2 on Wine 11.22 / RTX 5070 Ti, NVIDIA 620.73.04.

base: local dd44a4b53 boot integration + #7685, #7448, #8591, #7880 and #8458. With the new fixture alone, xg_xs reports 7 failures in 24 checks. With the runtime change applied, all 24 pass and gta6rt builds.

In a 185-second offline retail run, the previous texture-computer slot-10 refusal no longer appeared. The run recorded 4,228 successful PresentX calls to the visible title window, with no pipeline creation or command-list Close failures observed. Four sampled frames remained black. This validates the tiling path on this stack and does not identify the cause of the remaining black frames.

AI-assisted; aggregate results only.

@simonbronk

Copy link
Copy Markdown
Contributor

Tested #8763's xg_xs.cpp change on a local boot build of the retail 1.0.2.1 title (Windows 11, RTX 5070, 621.24). Before it, the slot 10 E_NOTIMPL line appeared once per run. With it, the line doesn't appear and the boot continues past that call site. I couldn't run xg_xs_test on that branch, because the test file isn't in its tree.

AI-assisted (Claude Code).

zneel added a commit to zneel/Leonida that referenced this pull request Nov 23, 2026
…ription (stand-in, upstream ItsNotRexed#8763's approach)

Measured call shape (one call site, the tiled branch of the title's streamed-texture record builder): slot 10 takes
the arguments of GetResourceTiling without the resource: a zeroed 4-byte total, a zeroed 12-byte packed mip info, a
zeroed 12-byte tile shape, an in/out count of 16, first index 0 and 16 12-byte records. The caller reads the two
level counts and each standard level's width, height and start tile, refuses 7 or more levels, and counts 16 pages
per tile. E_NOTIMPL left every count 0.

The answer is the PC's 64 KiB tiling (src/resource_tiling.h), logged as a stand-in for the first 8 answers and for
any answer the caller would refuse. In a retail boot the first 8 descriptions are one-level BC textures with layout
word 0x10a, 2 to 8 tiles each, none refused.

This does not clear the current stop (the int3 in the DirectStorage request builder): that texture's page count
comes from device slot 25, not from slot 10 (see the next commits' logs).

xg_xs ctest: 512x512 BC1 (2 tiles), a full 4096x4096 BC7 chain (5 standard levels + a one-tile tail, 342 tiles),
the count/first bounds, and E_NOTIMPL for a depth-stencil description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@LaugeM LaugeM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read at 32fb9d2e against main 5d74c2723. The slot 10 answer is right for what it covers, but two later PRs do this and more. #8529 and #9425 both answer slot 10 from the same resource_tiling.h rule, both also serve slots 2 and 8, and both return S_OK from XGCreateTextureComputer. All three change runtime/shims/xg_xs.cpp and runtime/test/xg_xs_test.cpp, so only one can land.

  • XGCreateTextureComputer still returns E_NOTIMPL (runtime/shims/xg_xs.cpp:182-187). The two callers that check the HRESULT still take their failure path. simonbronk and XIIYAZ report on #8529 that this path ends in a null or invalid read in the retail boot, and that #8529 gets past it. #9425 reports the same for its own retail run. Plausible (their runs).
  • computer_for (:169-179) keeps one computer per distinct 56-byte description for the whole run. That is bounded by the number of distinct texture descriptions, not by calls, so it is fine for now, but the comment should say so.
  • The measurement here is still useful after it closes: the first 52 bytes at the call sites are a D3D12_RESOURCE_DESC. That supports the ResourceDesc in #9425's xg_surface.h.

My suggestion is to close this in favour of #9425. If that stalls on its layout questions, this one is the safe minimal step.

AI-assisted review (Opus 5.5). Read the diff against main; not built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants