Repository navigation
d3d12_xs: list methods translate the title's CPU descriptor handles (OMSetRenderTargets, the clears; depends on #2490, #7021) - #8372
Closed
lunarminus wants to merge 10 commits into
Closed
lunarminus wants to merge 10 commits into
lunarminus wants to merge 10 commits into
Conversation
…nslate CPU handles
The d3d12_xs shim's device now hands callers console-shaped command lists (160-slot vtable, object body at +0x18 with the write cursor pinned at the record limits, console slots 27-30 recorded not forwarded, slot map measured to the PC table: 60->58, 61->59, 146->80). Queue layout detection is atomic and device-wide; SignalX (slot 23/25 by layout) forwards as Signal, PresentX (30/32) reaches the presentation core, and ambiguous slot 18 serves the timestamp- frequency getter until the layout is proven. AllocateUploadMemory (console slot 148) carves a bump arena out of persistently-mapped UPLOAD-heap buffers; the six root-VA setters and the IA/SO view setters translate arena pointers to buffer device addresses in proxy-owned copies. Impossible sizes and non-power-of- two alignments are refused before any arithmetic that could wrap. PC-compiled callers opt into real PC-shaped lists with console_lists=false on create_device_proxy, and PC-compiled guests with LEONIDA_D3D12_LISTS=pc — the fixture path check_tiny_frame.py sets, so a guest ClearRenderTargetView at PC slot 48 reaches the real list. The GPU tests take the flag; unmeasured console slots stay console-shaped for the title path. docs/d3d12_xs_console_abi.md records the measured ABI. Split from ItsNotRexed#2490 (third of three): fixes the run_tiny_frame failure the revert reported. AI-assisted. Hardware verification on the earlier identical code is in ItsNotRexed#2490's thread (RTX 3060 Ti-5080, RX 7600/9060/9070/7900 XT, Intel UHD, RADV; 177/177). Wine/clang-cl on the build host: xs_proxy_mock PASS incl. the overflow regression, queue_proxy child-runner section fails identically on unmodified main (Wine env), loader_test 86/0 upstream count. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
test_every_variable_is_named_in_a_document fails when a code-used environment variable is documented nowhere. The variable is described in the command-list section where the two list layouts are defined. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Upstream's device routes Xbox slot 73, but returned the real PC list unwrapped: the title's next console-slot call read through the PC vtable. With console_lists the device now builds the real list as ID3D12GraphicsCommandList and wraps it like the slot-12 path; a console IID is answered by the list proxy's QueryInterface.
The title's first call on a wrapped list is QueryInterface with the console command-list IID c3827890-...-51dc4874; is_list_iid knew only PC IIDs and refused it. Port the measured console->PC IID table from (closed, unmerged) ProjectLeonida#7124 into d3d12_xs_command_list_iid.h and run the requested IID through it in list_query_interface and in the PC-mode slot-73 path, so a console IID maps to ID3D12GraphicsCommandList6 and the caller gets the console-shaped proxy back.
create_device_proxy's console_lists default was true, so every test harness that links the TU and calls it directly got console-shaped lists and crashed or failed Close on PC vtable indices (kormocicsaba: d3d12_bindless_churn segfault, d3d12_mesh Close). The console shape is the title path: D3D12XboxCreateDevice opts in (unless LEONIDA_D3D12_LISTS=pc), and the default is now false so direct callers keep the pre-PR behaviour. The mock test pins both: slot 12 on a console_lists=false device returns the real list.
Pipodi measured the retail title calling console list slot 139 with (allocator proxy, pso) before recording — Reset, at PC slot 10. Map it and unwrap the allocator (and a pipeline state the same way); the unwrap now keys on the PC slot so console-10 and console-139 both land on the real Reset. xs_proxy_mock: PASS under Wine Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…his PR; the conflicts are the shared slot list, includes and mock kinds)
…OMSetRenderTargets, the clears) With ItsNotRexed#7021's descriptor heaps at the title's addresses, the title's CPU handles point into its own memory. The device's view slots 17-24 translate them; the command-list methods that take CPU handles did not, so the PC list got a handle that is not a layer view: ClearRenderTargetView failed its check, the list was marked invalid and Close returned E_INVALIDARG. The list proxy now translates the CPU handles of OMSetRenderTargets (render target array or single-range start, and the depth-stencil handle, in copies), ClearRenderTargetView, ClearDepthStencilView and ClearUnorderedAccessView {Uint,Float}: console list slots 50-54, PC 46-50. ClearDepthStencilView gets a thunk with its own signature, because its FLOAT depth travels in XMM3, which the integer forwarder cannot carry. Measured on a Wine boot of the retail executable: the failed Closes per run go from about 1,000 to 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lunarminus
force-pushed
the
list-cpu-handles
branch
from
November 23, 2026 18:41
edd87f6 to
ad0a688
Compare
Author
|
Closing as a duplicate of #7880, thanks @skorex. #7880 was opened earlier (17:42 UTC against 18:35) with a claim in #7694, and makes the same change. My claim search missed it, my mistake. I'll test #7880 on the same retail Wine boot I measured here (Radeon 760M, RADV) and post the result there. AI-assisted (Claude Code). |
1 of 2 tasks
|
Tested
|
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: #8186 (comment) (the command-list half of the CPU-handle translation that tupacfan04 listed as an open follow-up for #7021).
Depends on: #2490, #7021. This branch is stacked on both. Commit
1397f3cemerges them, with their conflicts resolved: the shared overridden-slot list, the includes and the mock's object kinds. Review only the last commit,ad0a688b; it rebases off once they land.What and why
With #7021, a title's descriptor heaps sit at the title's own addresses, so its CPU descriptor handles point into its memory. Device slots 17–24 translate those handles before the PC call. The command-list methods that take CPU handles did not, so the PC list received a handle that isn't a layer view record.
On a Wine boot of my own 1.0.2.1 retail executable (Radeon 760M; the stack is in #7154):
ClearRenderTargetViewfailed the layer's check and marked its list invalid;Closecalls per run failed withE_INVALIDARG;Closeleft once list slot 139 resets the lists (d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path #2490ef9d0759d).The list proxy now translates the CPU handles of the five list methods that take them, at console list slots 50–54 (PC 46–50, the +4 shift the proxy already uses):
OMSetRenderTargetsClearDepthStencilViewClearRenderTargetViewClearUnorderedAccessView{Uint,Float}translate_cpu_handlereturns any other handle as it is, so PC-shaped handles keep working.ClearDepthStencilViewtakes itsFLOATdepth in the fourth register position, XMM3, which the integer forwarder can't carry. So slot 51 gets a thunk with the method's own signature, installed in the list vtable like d3d12_xs: committed resources lease their size through the title's XMem hooks, so the first render targets pass the budget check (retail boot chain stop 17) #7240's slots 25/26.Tested
clang-cl 23.1.5 + xwin SDK 10.0.26100 cross build (RelWithDebInfo), run under Wine 11.22 on CachyOS Linux; AMD Radeon 760M (RDNA3 iGPU), RADV Mesa 26.3.1.
xs_proxy_mock_test: PASS, including the newcheck_list_cpu_handles:ClearRenderTargetViewand both UAV clears reach the mock PC list with the translated handle, and a handle outside every range passes unchanged;OMSetRenderTargetswith an array, then with a single range, captured with typed functions in a copy of the mock list's vtable: translated copies, and the title's array untouched;ClearDepthStencilViewtranslates its handle and keeps its depth (0.375), stencil and flags.d3d12_xs_device.cppreverted, the test fails at its firstClearRenderTargetViewcheck.ctest -R 'xs_proxy|queue_proxy|list_proxy|d3d12_xs': 7/7 passed.device_proxy_testneeds a real D3D12 device and fails with "no device" under Wine onmaintoo.Closeper run;Close;ClearRenderTargetViewis reached 425–539 times per run.No game data in the PR: hand-written mock inputs, counts and slot numbers only.
AI-assisted (Claude Code).
🤖 Generated with Claude Code