Repository navigation
d3d12_xs: the queue's PresentX presenter shares the device's frame-token source (#2490 + #7685) - #9229
d3d12_xs: the queue's PresentX presenter shares the device's frame-token source (#2490 + #7685)#9229AAyberkU wants to merge 9 commits into
Conversation
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) ItsNotRexed#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>
…oken source Device slot 80 (WaitFrameEventX, from ItsNotRexed#6935) numbered its tokens with a counter of its own, while XboxPresentation's pacer refuses any token above the ones it issued itself. A title that waits through the device and presents through the device's XboxPresentation therefore had every PresentX refused with E_INVALIDARG once its tokens ran ahead of the pacer's. leonida::FrameTokenSource is now the counter both use: a pacer takes an optional shared source (a standalone pacer still owns its own and numbers as before), the device proxy owns one and exposes it through rt::d3d12_xs::device_frame_tokens, and XboxPresentation passes a given source to its pacer. A token that was never issued is still refused. Reported by rafaelpssz in ItsNotRexed#7496.
present_state_for (from ItsNotRexed#2490) built the queue-side XboxPresentation with a pacer that numbers its own tokens. With ItsNotRexed#7685 device slot 80 (WaitFrameEventX) issues tokens from the device's FrameTokenSource, and the pacer refuses any token it never issued, so with both applied every queue PresentX of a title that waits through the device was refused with E_INVALIDARG. The presentation now takes device->frame_tokens, the source slot 80 draws from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016ABh377Xfov1ZDULWTYvTm
|
Independent confirmation on the retail 1.0.2.1 executable (own copy), Windows 11 26300, MSVC 14.44, i7-14700K, RTX 3080, Base: tibzejoker:rt5-integration@5fef1f1 + #6943 #6885 #6981 #7286 #7290 #7556 #7746 #8012 #7527 #8889 #7679 #7755 #8783 (no int3 left on this stack, see #8851 (comment)).
What it does not show: the window still shows no image here. That fits bobcatchris's mesh/amplification finding in #8868 and #8591's title window, both open. AI-assisted (Claude Code). No game data. |
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Independent Windows review (commit 73a4ff6ed64137e02189f6f6ae6f242e99ef22d3)
What changed:
runtime/shims/d3d12_xs_device.cpp:- Passes
device->frame_tokensinto theXboxPresentationinstance created byget_queue_presenter. - Ensures the queue presenter uses the identical frame token generator as device slot 80 (
WaitFrameEventX), eliminating token mismatch andE_INVALIDARGrejections when pacing presents against device frame tokens.
- Passes
Verification:
- Verified on Windows host: queue and device share atomic frame token sequence.
- Clean diff: no game files.
LGTM!
|
Note for review: the maintainers' forge main (git.notrexed.dev/enx/leonida main, 2ac3858) solves the same mismatch another way in 097e9f4. There, device WaitFrameEventX goes through the presentation when one exists, and AI-assisted (Claude Code). |
Claimed in #9065 (comment) (first posted in #8868).
What
present_state_for(from #2490) builds the queue-sidert::d3d12::XboxPresentationwith the one-argument constructor, so its frame pacer numbers tokens from a counter of its own. This passes the device's token source instead:Why
#7685 makes device slot 80 (WaitFrameEventX) issue tokens from
device->frame_tokens, and the pacer refuses any token it never issued. With both PRs applied, a title that waits through the device and presents through the queue gets E_INVALIDARG on every PresentX, because the queue-side pacer never issued those tokens. Sharing the device's source makes the tokens the title gets the same ones the pacer accepts. A token that was never issued is still refused. The authors of #7685 asked for this line on that PR.Measured
On the retail title (LEONIDA_D3D12=vulkan, boot stack in #8851): with this line every PresentX returns S_OK, about 100 per second over 90 s. Without it, none does.
Tested
-DLEONIDA_REQUIRE_VULKAN=ON, NVIDIA GeForce RTX 5060 Ti, driver 621.01:gta6rt,device_proxy_testandxbox_present_testbuild, anddevice_proxy_testpasses.present_state_foris compiled only underLEONIDA_VULKAN_DEVICE(thegta6rttarget), and no test target drives a queue PresentX through it. PresentX: device-side WaitFrameEventX and the frame pacer share one token source #7685'sxbox_present_testalready covers a slot-80 token being accepted by anXboxPresentationbuilt on the device's source.Depends on: #2490, #7685
AI-assisted (Claude Code).
🤖 Generated with Claude Code
https://claude.ai/code/session_016ABh377Xfov1ZDULWTYvTm