XGTextureAddressComputer #10 is GetResourceTiling (read from the cons… #192
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!192
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/192/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?
@gbuyssens on GitHub · 2026-11-23 20:01 UTC · original
gbuyssens:pr/xg-resource-tiling→main· +107 −1 · 1 files · 1 commits · closed without merging…ole library's code)
The library's vtable, disassembled: slot 10 takes ID3D12Device::GetResourceTiling's six arguments for the computer's resource – it reads *pNumSubresourceTilings, writes a D3D12_PACKED_MIP_INFO, a D3D12_TILE_SHAPE and D3D12_SUBRESOURCE_TILINGs indexed by D3D12 subresource skipping the packed levels. E_FAIL unless the swizzle mode is a 64 KiB one (8–11, 16–19, 24–27), E_NOTIMPL for 1D and 3D textures; the standard tile in elements goes by their size (256×256 for 1 byte … 64×64 for 16), reported in texels; a level's tiling is its padded size over the tile, its start tile the level's offset in 64 KiB tiles plus the slice's; the packed levels take one tile at the first one's offset. A title's texture streaming asks this for every texture it places in a tiled pool.
The guess taken from ivall/xcl#169 (GetSubresourceLayout / Offset, sniffing which arguments are pointers) answered E_INVALIDARG by luck with the real arguments (the "plane" was the low half of a pointer) and would have written 0x70 bytes over a 12-byte tile shape otherwise. Slot 11 is GetDescriptor(plane, 32-byte hardware descriptor), not modelled: a stub again.
Test: resource_tiling_of_a_64kb_texture.
@Kalmarv on GitHub · 2026-11-23 20:40 UTC · original
AI-assisted triage (Claude Code) of
XGTextureAddressComputerslot 10 across #169, #192 and #195. Windows 11 (10.0.26200), Ryzen 9 9950X, Rust 1.99.0 MSVC, debug profile. CPU-only unit tests (no GPU is involved), synthetic textures only, no game files and no console library.Tested heads, each one directly on
main956a476, so each PR head is the merge result:428313150cff5dbf26412mainas the controlThis builds on the #192-vs-#195 comparison in https://github.com/ivall/xcl/pull/195#issuecomment-7113115680 (3D tile depth, 4 KiB modes, packed entries) and doesn't repeat it. The new parts are #169 against the other two, arrays, and how each one compares with the documented API.
Method. One probe, compiled unchanged into all four trees. It builds a computer and calls vtable slot 10 with
GetResourceTiling's six arguments, and slot 11 with #192'sGetDescriptor(plane, 32-byte descriptor), the way a title calls them. Every output is pre-filled with 0xCC, and the shape and descriptor buffers have guard bytes after them.main(0,0,0,0xFFFFFFFF))(NULL, NULL, &shape, &count, 0, tilings)(&tiles, NULL, NULL, NULL, 0, NULL)tilesnot written(0, 32-byte buffer)Probe result:
mainfails 1 check (A). #169 fails 4 (A, C, D, E). #192 and #195 fail none. The PRs' ownxgtests pass on their heads: #169subresource_layout_and_offset, #192resource_tiling_of_a_64kb_texture, andrgba8_64kb_s_layouton all three.#169 against the other two. #169 doesn't implement
GetResourceTiling. It answers slots 10 and 11 asGetSubresourceLayout/GetSubresourceOffsetBytes, and works out which form was called by checking which arguments look like pointers.With
GetResourceTiling's real arguments, the result depends on which outputs the caller passes:XG_SUBRESOURCE_LAYOUTover a 12-byteD3D12_TILE_SHAPE.GetDescriptor(0, buf): it writes 0x70 bytes over the 32-byte descriptor and returns S_OK.All of the NULL outputs above are
[out, optional]in D3D12, so these are legal calls.TheFrenchPepeAI's runs show #169 clearing the null write at
+0x2215c35. This doesn't say which of #169's answers did it. It could be E_INVALIDARG from slot 10 instead of E_NOTIMPL, or S_OK (plus the overflow) from slot 11. Someone with the title should run #192 alone and see whether it also gets past+0x2215c35. If it does, #169'sxg.rspart can be dropped. Its DSV-118 and mesh-pipeline parts aren't affected by this triage.#192 and #195 agree on every 2D 64 KiB case I tried:
first = 9;That matches D3D12's standard 64 KiB 2D tile shapes. They differ only in the three places already reported.
An array with packed levels (new). RGBA8 256×256×2, full chain, room 18:
count18.count4.So with #192 a caller that reads
countentries from the start gets two real entries and two untouched ones. With room 4, #192 returns only slice 0's two entries, because room limits the subresource index range, not the number written. If the console library does this too, fine, but it is worth a line in the doc comment and a test. @gbuyssens, could you confirm from the disassembly whether*pNumSubresourceTilingson return is the number written or the index span?Against the documentation. The console's
XGTextureAddressComputeris not publicly documented. The public reference is PCID3D12Device::GetResourceTiling, which this slot's six arguments mirror. It says:*pNumSubresourceTilingsis "the number that was actually retrieved … (clamped to what's available)";StartTileIndexInOverallResource = D3D12_PACKED_TILE;#195 follows that on the packed entries and the count. #192 departs from it there, and says this follows the console library's code, read from its disassembly. I can't check that without the library, and #192 is the only one of the three with a stated console source. Neither PC D3D12 nor #192 has a 4 KiB "tile", and #195's 3D shape is wrong whatever the library does (see the earlier comment).
My suggestion:
+0x2215c35.Not tested:
@ivall on GitHub · 2026-11-23 20:57 UTC · original
Closing: main has XG computer #10 as GetResourceTiling, checked against the console library itself (
tests/xg_oracle.rs,resource_tiling_matches_the_console_library, 8 960 cases, none differ: 64 KB tiles, the mip tail as tile 0,countout = standard-mip subresources written atsub - first, non-64KB modes E_FAIL). Thanks!Pull request closed