Repository navigation
d3d12_xs: the device and queue proxies follow the console method order, not the PC one, so a console method no longer lands on a wrong PC method (XValkyrie B4/B5) - #7490
Conversation
Device slots 43-82 and 104 are console methods (handled, accepted or refused, every call counted and reported with its caller); ID3D12Device1..8 are forwarded from 83-103 and 105-112. The queue proxy decides between the two known console layouts from the first fence call. Facts from xvalkyrie 53af7df77c10, checked against docs/d3d12_vulkan.md section 7. WIP: tests that use the proxy as a PC device still need moving.
…sts share device_method
…#6953 merges without a conflict
This reverts commit 23e7efb.
|
Measured in a local integration on main 9f53c50: the focused slot PRs compose into two working stacks - #6964 (26), #6954 (48), #7076 (73), #7066 (70), #7110 (25), #7052 (127), #7218+#6953 (133) - reaching 1,181 ok D3D12 calls in one stack and the descriptor heap / slot 70 / slot 133 / slot 25 sequence in another. This PR restructures all of those slots at once, so every one of them collides: Suggestion: split by slot, or rebase on the focused set and keep the slot table as the single shared change. Reviewing 7 small diffs is easier than re-verifying one large one, and a slot that regresses then has an obvious owner. |
|
An AI review of c69debd (Claude Code ultrareview, multi-agent with a verification pass; I checked the main claims against the head before posting). Four findings, most important first:
AI-assisted. |
|
Thanks @AwkGrep256 for the review, all four points confirmed and handled in |
|
Tested
AI-assisted: yes |
|
Thanks @sgonzalez-glitch, that run was exactly what was missing (my pod is Wine, no host D3D12). Pushed |
|
Tested The failure is Cause: this PR removes Shifting the indices (17-20 to 16-19, 25 to 24, 26-29 to 25-28, 30/31 to 29/30) makes No game files. AI-assisted (Claude Code). |
…andQueue1 case (a null fence entry no longer runs in-process and leaks a PC device reference)
|
@optinium51-bot thank you, that is the cause I could not find: removing |
|
Independent diagnostic relevant to the queue portion: on the integrated Windows/RTX 5080 stack with #6891 and #7201, queue slot 18 is the last D3D12 call before a title write fault at 0x20. Existing frequency routing, a no-op, and PC GetDesc all give the identical fault and stack. The experiments were reverted. This does not disprove the console-order table, but this particular stop needs title-side call-path evidence before another queue-layout change. |
Use the later console queue slots when the first argument is a fence proxy. Preserve the PC timestamp calls for normal output buffers. Console slot ordering also documented in upstream PR ItsNotRexed#7490.
|
Tested
AI-assisted (Claude Code), no game files. |
|
Re-tested the new head
No game files. AI-assisted (Claude Code). |
|
Re-ran on the same machine (native Windows 11, NVIDIA GeForce RTX 2080, driver 621.24 / 32.0.16.2124, MSVC 19.44 RelWithDebInfo), each merged onto main
AI-assisted: yes |
…t caller gets PC CreateMetaCommand The proxy also serves host callers: d3d12_vulkan_device_test drives the Vulkan device through it, and its ID3D12Device5::CreateMetaCommand call (PC slot 61) landed in proxy_create_sampler_x (found by nullmarsh on ItsNotRexed#7115: the test stopped at line 5763 instead of main's known line 6574). Slot 61 now checks the caller's return address with a classifier the runtime installs (set_console_caller, the name ItsNotRexed#7490 uses): D3D12XboxCreateDevice installs rt::shims::mapped_image_base, so only a caller in an image the guest loader mapped gets CreateSamplerX. Any other caller, and every caller when no classifier is installed, is forwarded to the PC slot 61. xs_proxy_mock_test checks all three cases: no classifier (PC slot 61), a guest caller (PC CreateSampler with the same words; a null description skipped) and a host caller under an installed classifier (PC slot 61). d3d12_vulkan_device_test again stops at line 6574, as on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent Windows x64 + AMD Radeon RX 6600 verification of Environment:
Checks run:
Review notes:
|
|
Tested
Note: the PR head has since moved to AI-assisted test report (Claude); tests run locally as stated. The diff was read in full before running. |
|
Tested e05b550 (head of this PR) on RTX 5070 Ti (Blackwell, subgroup 32), NVIDIA 621.01, Windows 11, MSVC 14.44 (VS 2022 17.14 Build Tools), CMake 4.5.1 + Ninja, Vulkan headers sdk-1.4.363.0 (fetched), no game copy: pass, with one unrelated failure. I applied the diff to a clone of main at dfe4e4a (clean git apply), built and ran xs_console_slots_test, device_proxy_test, queue_proxy_test, xs_proxy_mock_test, dxgi_device_test, dxgi_swapchain_test, d3d12_debug_markers_test, d3d12_fence_timing_test and d3d12_vulkan_device_test. All exit 0 except queue_proxy_test. xs_console_slots_test (new) ends "all passed". queue_proxy_test exits 1 on this PR, and also on unmodified main at dfe4e4a, but at a different check: main stops at "queue GetClockCalibration(null, null): proxy did not report 0x00000000 ... real 0x80070057", this PR at "MakeResident(descriptor heap, fence): the real-object child did not report". I did not find out whether the PR fixes the first failure and exposes an older one, or introduces the second. d3d12_vulkan_device_test exits 1 on unmodified main here (2 of 2 runs) and 0 with this PR (2 of 2 runs); I did not pin down which check differs. Not run: d3d12_mesh_test (not built, no glslangValidator) and the rest of the ctest suite. I did not run the negative control for the new test. AI-assisted (Claude Code): checked by applying the diff to a private clone of main and building and running the tests above. No game data was used. |
… unrelated PC methods Slot 57 is the console's graphics pipeline from the pipeline library in shaders.rpf, the graphics sibling of slot 67: (desc, riid, out). Every call went to the PC CreateLifetimeTracker and was refused (25,450 times in a 120 s boot of retail 1.0.2.1; the library has 25,471 graphics records). The description, dumped from the title's first calls: root signature, state blob, pipeline (input-layout) blob, then stage slots of (program, size, stage blob, size) in the library record's order, PS at +0x28 and VS at +0x48; slot 2 at +0x68 is taken as the MS by the record's order (not yet seen). The stand-in hands the programs and root signature to the PC device with D3D12's default fixed-function state, since the state blob is undecoded; a mesh pipeline goes through ID3D12Device2::CreatePipelineState. The Vulkan device has no lookup for bare library graphics programs yet: it refuses them as a missing translation, so LEONIDA_STUB_PIPELINES=1 turns them into no-op pipelines instead of E_INVALIDARG for a non-FSSM stage. Slot 86 is the public ID3D12Device2::CreatePipelineState (the console places Device1-5 39 slots past their PC places, as ItsNotRexed#7490/ItsNotRexed#7201 map it): the stream goes to PC slot 47 unchanged instead of being refused past the 80-slot table. xs_proxy_mock: check_pipeline_slots (VS+PS, VS only, MS+PS stream, refused shapes, a PC refusal, slot 86 forwarding and a device without Device2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@BeetjeMatig thank you for the careful run. Other native runs of |
|
Tested 4/4 passed in 27.97 s. |
Claimed in #6750 (comment)
@ItsNotRexed: an exe PR, as you asked.
What
The device and queue proxies follow the console vtable order instead of the PC one.
runtime/shims/d3d12_xs_console_slots.h(new): the console device order (0-42 public; console methods at 43-82 and 104;the public ID3D12Device1..5 at 83-103 and Device6..8 at 105-112, forwarded 39 or 40 slots lower) and the two known
queue layouts (kit2020 and the later kit, which moves everything from Signal on by 2).
60 CreateGraphicsPipelineStateX (console flag bits removed); 61 CreateSamplerX (84-byte console sampler); 68
GetGpuHardwareConfigurationX; 74/75 Register/UnregisterPagePoolX; 81 GetFrameStatisticsX (count 0, S_FALSE);
111 the feedback UAV with the console argument order; 49-54, 58, 69, 72 accepted with no effect. Anything else
is refused with E_NOTIMPL and never reaches a PC method.
moves a route away.
or a call at 32/33; the word is checked with VirtualQuery first. Until then a layout-dependent slot does nothing.
four argument words, so the first boot names every console method the exe uses.
Why
In PC order, console methods at 44-82 land on PC Device1..14 methods (#6498: slot 78 reached
CreateReservedResource2). The queue sent 16-18 to GetTimestampFrequency/GetClockCalibration/GetDesc, which the
console queue does not have there. This gets the exe past device and queue calls that went to the wrong method.
Tested
Pod p2 (RTX 4090), clang-cl + xwin, Wine, DISPLAY=:99.
at line 257 (a console slot reached a PC Device1+ method), and the two layout modes exit 5. Negative controls:
26 public Device1..8 slots must reach PC 44-72, and 44-82, 104 and 113-127 must reach none.
(d3d12_fence_timing check_luid: the test device's LUID is zero, line 248 on main).
d3d12_fence_timing, dxgi_device, d3d12_mesh, queue_proxy, device_proxy, xs_proxy_mock (d3d12_xs: route the public HLE's Xbox device slots 48/73/78/79/80 #6935's env tests now
expect the console order: a moved route leaves 78 refused; a public method at 86 reaches PC 47).
Shared helper: runtime/test/xs_console_call.h.
(queue_proxy's child-runner check hangs). With that one check skipped locally, queue_proxy's Vulkan run passes
on this branch (31 differential cases, all 128 queue and 64 fence slots covered); on main it stops at its guard
check. device_proxy skips on both (no host D3D12 under Wine).
xs_proxy_mock (6 modes) and xs_console_slots (3 modes).
What xvalkyrie gave
Facts only, from sammwyy/xvalkyrie (GPL-3.0) at commit 53af7df77c10: src/runtime/modules/d3d12x/device.cpp:4196-4262
(device order, names and argument shapes of 43, 44, 48, 49-55, 58, 60, 61, 68, 69, 72-75, 78-81 and the
Device1..8 positions), device.cpp:2036-2186 (the two queue layouts) and docs/research/d3d12x.md. The sampler
layout is the kit's as xvalkyrie read it. No code was copied. Checked against Leonida's own measurements
(docs/d3d12_vulkan.md §7, docs/d3d12_command_objects.md §3.5a): device slots 1, 14-16, 18, 19, 27, 38 in PC order
and 62/67/76 console-only all fit. Where they differ, ours is kept: xvalkyrie leaves 67 unknown, and its
CreateCommandQueueX has three arguments where docs/d3d12_xs_surface.md inferred a shader-queue parameter (recorded,
not used). docs/d3d12_command_objects.md §5.2a has the full table.
Overlaps
Open PRs touching the same dispatcher: #7201 (86/101/108 to PC Device2/5/8: the same mapping, a subset of this
one), #7115 (61), #7187 (caller logging), #7066 (70), #7235 (127), #7218/#7075/#7183 (133). Slots 70, 127 and 133
stay refused here for their owners. #7218 names 133 CreatePlacedResourceX; xvalkyrie puts that method at 44.
Known limits
GetDesc(queue slots 26/28) answersS_OKwithout writing the return buffer. Those slots are a different method in the other console layout, so writing through the first argument could corrupt memory; this PR leaves it open on purpose.CreatePlacedResourceX) is a committed stand-in, as its comment and the first-call log line say: the title's memory at that address is not shared with the resource.AI-assisted: yes