Repository navigation
d3d12_xs: GetResourceAllocationInfo answers console tile sizes for 2D render targets (slot 25 return-buffer form; sizes #7240 leases at stop 17) - #7078
Conversation
The retail executable calls GetCustomHeapProperties (device slot 26) with the C convention: the hidden return buffer in RCX and the device in RDX. The proxy's generic forwarder assumed the PC C++ form (this in RCX, buffer in RDX), took the buffer for the device and crashed on its vtable right after D3D12XboxCreateDevice. Slots 25 (GetResourceAllocationInfo, same rule, inferred) and 26 (measured) now get thunks that accept either form: whichever of the first two arguments is the device proxy is `this`. The runtime's own code still calls the proxy through d3d12.h in the PC form. device_proxy_test calls both slots in both forms against WARP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The retail executable calls GetCustomHeapProperties with the return buffer in RCX and the device in RDX. The forwarder took RCX for the proxy and faulted. AI-assisted.
…two comments AI-assisted.
AI-assisted.
…(RT-5 stop 17) The retail title asserts when its first full-screen render targets leave more than 2 MiB of a fixed budget unused (docs/retail_boot_chain.md, ItsNotRexed#6982). The PC size is about width x height x element bytes; the console takes whole RDNA2 SW_64KB tiles. Slot 25 adds the difference per render target description and never lowers a size. Depends on ItsNotRexed#6973.
|
Independent native Windows check at 8897855, built with clang-cl/xwin. Both xs_proxy_mock and device_proxy passed (2/2, the latter on WARP). The slot 25 regression confirmed the expected 524,288-byte padding for the synthetic 1920x1080 target. Retail boot was outside this run. AI-assisted testing and write-up. |
Senya01
left a comment
There was a problem hiding this comment.
Tested 88978553 on RTX 5070 Ti, NVIDIA 617.14, Windows 11 build 26300, MSVC 19.44 Release, Vulkan headers 1.4.363: the retail boot still stops at the same point in this configuration.
Control: Pipodi:boot-integration at eaee3d481 with the already-merged frame-event routes (slots 78–80) from #6935 applied locally. Test: the same build with this PR’s allocation-size helper applied to slot 25 after the branch’s existing descriptor normalization. Two runs per build, retail 1.0.2.1, Vulkan, fresh overlay, offline AppContainer, assert skipping off. --dry-run and --init passed in all four trials.
In all four runs, two 3840×2160 RGBA8 render targets were created. Slot 25 returned 33,423,360 B with 65,536 B alignment for each. That already equals 30 × 17 × 65,536 B, so the rule adds zero for these descriptors. Each run recorded 1,639 D3D12 calls and exited 0x80000003 at the same breakpoint after the second target’s views were created, consistent with stop 17 in #6982.
Scope: this isolates the padding rule on a local integration. The branch’s existing xmem synthetic test had the same two failures in both builds. The DirectStorage and TLS fixture tests passed in both.
AI-assisted: yes. Testing and report by OpenAI Codex (gpt-6.2-sol).
|
Retail stop 17 still reproduces on CachyOS / Wine 11.22, RTX 4070 (620.73.04), with |
|
A static read of the stop-17 check in the retail executable (1.0.2.1; nothing run; only names, counts and conditions), to help with the 2 MiB question this PR leaves open:
So the counted allocations must total between 62 and 64 MiB. With only the loop's targets:
With these targets the tile padding does not change the outcome. At 4K the plain PC sizes already pass, and at 1080p no padding closes the gap. If a run still stops here, the cause is one of these:
I did not trace which call hands the hook its size. Slot 25's AI-assisted (Claude): Python 3.12 and Capstone on Linux, reading the file only. |
|
Confirmed the hook hypothesis in an A/B on CachyOS / Wine 11.22 (RTX 4070). Same runtime and slot-25 sizes. Without the probe, stop 17 reproduces. With a local probe calling the title allocation hook for both successful slot-127 RT allocations, both callbacks return non-null and boot reaches the first XboxBvhBuilder compute PSO. The GPU resources still use separate backing. AI-assisted analysis and testing. |
…t 26 from ItsNotRexed#6964, slot 25 return-buffer form kept from ItsNotRexed#6973
|
One synthetic regression case for slot 25 at Take the PR’s 1920×1080 RGBA8 target (host size 8,323,072 B, padded size 8,847,360 B), followed by a mocked MSAA target with a 4 MiB size and 4 MiB alignment. The host places the second target at 8 MiB and reports 12 MiB total. After tiling, the first target crosses the 8 MiB boundary, so the second target must start at 12 MiB and the batch needs 16 MiB. Adding the 512 KiB delta gives 12.5 MiB, which also fails the returned 4 MiB alignment. Could AI-assisted code review. Checked the arithmetic with synthetic inputs. The retail boot path was outside this check. Native D3D12 follow-up (Windows 11 WARP): I queried slot 25 with a 1920×1080 RGBA8 render target followed by a 128×128 RGBA8 4× MSAA render target. WARP reported 12,582,912 B for the batch and 4,194,304 B alignment. Changing only the first target’s height to 1152 made its standalone size exactly 8,847,360 B, matching the tile-padded size above. The native batch then reported 16,777,216 B with the same alignment. This uses synthetic resource descriptions and checks the host API directly. |
|
Tested #7110's head
AI-assisted (Claude Code). |
…t, slot 56 offsets, full mip chains, rounded-up mip extents, B5G5R5A1, saturating sums
|
Thanks to Codex's review and to alpha325, who posted the same mixed-alignment MSAA case. All seven findings are fixed in 3593908, on top of a real merge of origin/main and #6964's head (40360cc: slot 26 is #6964's code, slot 25 keeps the return-buffer form from the closed #6973, credit @sneylol).
Title and body are updated: the padding alone does not pass stop 17 (jacksonslab and jlric measured it); the check passes with #7240 plus these sizes. Not run: the retail exe, device_proxy_test (builds, no WARP on the pod). AI-assisted. |
|
Independent native Windows 11 / MSVC 19.44.35230.0 / AMD Radeon RX 6700 XT (
AI-assisted (Gemini, Antigravity). |
|
Follow-up on I verified the API contract with native D3D12 WARP on Windows 11 using two synthetic 1920×1080 RGBA8 render targets. AI-assisted code review and host-API test. No game files used. |
…er-resource array
|
Tested
AI-assisted (Claude Code). No game files. checked: #7078e2aa0eb | with: ctest -R "^(device_proxy|device_proxy_trace|xs_proxy_mock.*)$", PR merged onto main@867d922f next to main | on: Windows 11 Pro 26200, NVIDIA GeForce RTX 5080 (driver 621.24), clang-cl 23.1.6 + xwin (Windows runtime ON) | result: pass, 8/8 on both sides |
|
Heads-up for merge order with #7110 (code read plus a run at
AI-assisted (Claude Code). |
|
@pvfreis thank you for the merge-order note. Both this PR and #7110 are already in the official |
…wers console tile sizes for 2D render targets (slot 25 return-buffer form; sizes ItsNotRexed#7240 leases at stop 17) Squashed from ItsNotRexed#7078 by tedin7, head 3ace986 (security scan PASS). Conflicts with ItsNotRexed#6954 (slot 48): header comment, slot overview in d3d12_xs_device.h and the mock test's check list keep both PRs' slots; slot 25/26/56 text and device_slot_overridden take this PR's form (it contains ItsNotRexed#6964).
…x layout word and flag bits on a copy before the PC GetResourceAllocationInfo (retail boot chain stop 16) Squashed from ItsNotRexed#7110 by tedin7, head 77878e3 (security scan PASS). Conflicts with ItsNotRexed#6954 (slot 48): the header comment and d3d12_xs_device.h keep the slot 48 text, the mock test's check list keeps check_slot48; everything slot 25 takes this PR's version (it contains ItsNotRexed#7078).
…ResourceX) makes a buffer on the title's own pages (VK_EXT_external_memory_host) Squashed from ItsNotRexed#7218 by tibzejoker, head 4fb24d2 (security scan PASS). Head moved from the scanned c3fe825 to 4fb24d2 (two commits: page-base import with bind offset, committed texture fallback); the new commits were re-scanned (prescan: no flags; Haiku read: PASS). Contains ItsNotRexed#6953. Conflicts with ItsNotRexed#6964/ItsNotRexed#7078: the slot-26 handler and the slot-133 handler both kept; device_slot_overridden lists 25/26/56 and 133.
…ource's memory through the title's XMem hook (retail boot chain stop 17) Squashed from ItsNotRexed#7235 by NiiRoZz, head f5dae9f (security scan PASS). Contains ItsNotRexed#7021 and ItsNotRexed#7052. registry.cpp stays on the SRWLOCK form adopted for ItsNotRexed#7021 here (this PR's copy of ItsNotRexed#7021 re-adds the function-local statics). The mock's slot 25 stays on ItsNotRexed#7078's description-based mock_allocation_info; this PR's mock_call case 25 (a fixed allocation_size) is dropped. Union of slot lists, check lists and the slot-18 null description as before.
…namic statics in d3d12_xs, d3d12_xs_device and xgameruntime_offline Squashed from ItsNotRexed#8178 by piyonchu, head aefa7be (security scan PASS). Applied as the PR's own diff (gh pr diff). One pattern per file: d3d12_xs.cpp keeps ItsNotRexed#7957's global INIT_ONCE helpers (already on main), so this PR's local-static INIT_ONCE versions there are not taken; d3d12_xs_device.cpp and xgameruntime_offline.cpp take this PR's INIT_ONCE form. The device vtable's INIT_ONCE keeps ItsNotRexed#7078's slot 25/56 struct-return entries (this PR's version predates them), and ItsNotRexed#2490's list vtable gets the same INIT_ONCE form, since lists are made on title threads.
Claimed in #6910 (comment)
@ItsNotRexed: an exe PR, as you asked.
Depends on #6964 (slot 26 console form); carries the slot 25 return-buffer form from the closed #6973 (credit @sneylol). The branch is merged with
origin/mainand #6964's head: slot 26 is #6964's code, slot 25 keeps #6973's return-buffer form. #6973 was closed in favour of #6964, so nobody else owns the slot 25 form now.What
GetResourceAllocationInfo) and slot 56 (GetResourceAllocationInfo1) give a console-sized answer for a 2D, single-sample render target of a listed colour format. Every mip is rounded up to whole RDNA2SW_64KB_Dtiles (runtime/src/gfx10_tiling.h: 256 x 128 pixels for 2-byte elements, 128 x 128 for 4-byte, 128 x 64 for 8-byte, 64 x 64 for 16-byte). MipLevels 0 is the full chain, an odd mip extent rounds up, and the first mip that fits in half a tile's width and a whole tile's height, with the mips after it, shares one tail tile. The size is multiplied by the array size.runtime/shims/d3d12_xs_alloc_size.h(the rule, no state), the slot 25 and slot 56 thunks ind3d12_xs_device.cpp, a paragraph indocs/d3d12_vulkan.md.Why
Stop 17 of the retail boot chain (#6982): right after the title creates its first full-screen render targets, a fatal assert checks a fixed memory budget against what the targets used. The PC sizes come out smaller than the console's: a 4-byte-element PC size is about width x height x 4, the console pads to 128 x 128 tiles, so 1080 rows take 9 tile rows.
These sizes alone do not pass the check: jacksonslab and jlric measured that on the retail executable. The check passes with #7240 (jacksonslab), which leases the memory through the title's hooks, plus these sizes; #7240 uses this PR's padded sizes for the lease. Not measured, and said in the docs: that the title's console sizes are exactly these tile shapes with no DCC or CMask memory in them.
Review
Codex's review of the first version found seven defects, all fixed here; alpha325 posted the mixed-alignment MSAA case independently. A 1 x 1 four-sample target (4 MiB, 4 MiB alignment) next to a 1080p target needs 16 MiB, not the 12.5 MiB the first version gave. Info1 offsets follow the padded sizes (the second 1080p target starts at 8,847,360, not 8,323,072). MipLevels 0, the mip tail rule, rounded-up odd mip extents, B5G5R5A1 and overflow are fixed too.
Tested
Cross-built with clang-cl against the xwin SDK and run under Wine (pod,
xs_proxy_mock_test, no GPU, no game files). The mock PC device answers as a driver without tile padding, with 4 MiB alignment for multisampled resources and the Vulkan layer's sequential layout.40360ccb4) the new checks fail on every item above except the 65 x 32 RGBA32F one (it guards a format mutation, and the old code was already right there). With the fix:xs_proxy_mock_test: PASS. The d3d12_xs: device slot 26 takes the return buffer in RCX and the device in RDX, as the retail executable calls it (RT-5) #6964 slot 26 checks and the Xbox slot checks from main still pass.device_proxy_testbuilds; it skips on the pod (no WARP adapter).tests/test_docs_*pass excepttest_docs_linksondocs/dev-tools.md(an anchor from main, not touched here).AI-assisted: yes