Repository navigation
d3d12_xs: device slot 25 takes the console's struct-return form too (RT-SLOT25) - #362
Conversation
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. (cherry picked from commit 86b8e04)
…te Xbox description Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 0cde63d) Adapted to main by Mumogg: main already routes slot 48 through its Xbox slot table (LEONIDA_XS_QUEUE_X_SLOT), so the route now calls proxy_create_command_queue_xbox instead of a fixed slot 48 branch, and xs_proxy_mock's check_xbox_slots and the environment case pass the console's 32-byte description.
…ead of reaching PC CreatePlacedResource1 (retail boot chain stop 14) (cherry picked from commit 3073250)
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> (cherry picked from commit 5dbc30b) Adapted to main by Mumogg: slot 26 keeps the thunk it already has (86b8e04), so of this commit's two thunks only slot 25's is installed.
The mock device answers GetResourceAllocationInfo, and the new case calls slot 25 with the return buffer in RCX and the device in RDX, then in the PC form: both reach the PC method with the mask, count and descriptions, and only the struct is written. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
|
I reproduced a slot 26 test regression on native Windows and tested the small patch below on this PR's head The new WARP coverage calls slot 26 four times before the existing block reaches its absolute hit-count checks. Measuring the increase from the start of that block preserves the routing checks. Checking the returned heap properties separately also keeps a counter failure from being reported as a forwarding failure. After applying the patch, all 8 Test-only patch for 9bc1f8fdiff --git a/runtime/test/device_proxy_test.cpp b/runtime/test/device_proxy_test.cpp
index 3fb0ba1d..b3b3f0fc 100644
--- a/runtime/test/device_proxy_test.cpp
+++ b/runtime/test/device_proxy_test.cpp
@@ -255,6 +255,7 @@ int main(int argc, char** argv) {
D3D12_HEAP_PROPERTIES*(WINAPI*)(D3D12_HEAP_PROPERTIES*, void*, UINT, D3D12_HEAP_TYPE);
auto get_custom_heap = reinterpret_cast<XboxGetCustomHeapPropertiesFn>(proxy_vtbl[26]);
const D3D12_HEAP_TYPE heap_types[] = {D3D12_HEAP_TYPE_DEFAULT, D3D12_HEAP_TYPE_UPLOAD, D3D12_HEAP_TYPE_READBACK};
+ const auto slot26_hits_before = rt::d3d12_xs::device_slot_hits(26);
bool console_returns_buffer = true, console_matches_pc = real != nullptr, console_writes_only_struct = true;
for (const D3D12_HEAP_TYPE type : heap_types) {
struct Padded {
@@ -272,15 +273,18 @@ int main(int argc, char** argv) {
check(console_returns_buffer, "slot 26 console form returns the buffer's address");
check(console_matches_pc, "slot 26 console form writes the PC device's DEFAULT, UPLOAD and READBACK properties");
check(console_writes_only_struct, "slot 26 console form writes nothing past the struct");
- check(rt::d3d12_xs::device_slot_hits(26) == 3, "slot 26 hit counter is 3");
+ check(rt::d3d12_xs::device_slot_hits(26) == slot26_hits_before + 3,
+ "slot 26 hit counter increases by three for the console calls");
check(rt::d3d12_xs::is_device_proxy(device.Get()) && rt::d3d12_xs::device_proxy_real_device(device.Get()) == real,
"the proxy is intact after the console-form calls");
// A PC C++ call through the proxy (the proxy in RCX, the buffer in RDX) is still forwarded.
const D3D12_HEAP_PROPERTIES pc_form = device->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD);
const D3D12_HEAP_PROPERTIES pc_want = real ? real->GetCustomHeapProperties(1, D3D12_HEAP_TYPE_UPLOAD)
: D3D12_HEAP_PROPERTIES{};
- check(real && std::memcmp(&pc_form, &pc_want, sizeof(pc_want)) == 0 && rt::d3d12_xs::device_slot_hits(26) == 4,
+ check(real && std::memcmp(&pc_form, &pc_want, sizeof(pc_want)) == 0,
"slot 26 PC form still forwards GetCustomHeapProperties");
+ check(rt::d3d12_xs::device_slot_hits(26) == slot26_hits_before + 4,
+ "slot 26 hit counter also includes the PC call");
// Slot 14: descriptor heap through the proxy. The proxy wraps the real PC heap for the handle ABI.
D3D12_DESCRIPTOR_HEAP_DESC heap_desc{}; |
…t of their block The slot 25/26 cases added before this block call slot 26 four times, so its absolute counts (3, then 4) failed on Windows. The counts are now increases from the block's start, and the forwarding check no longer shares a line with a counter, so a counter failure is not reported as a forwarding failure. Patch by BadgersMC, from the review of ProjectLeonida#362 (found and tested on native Windows with WARP; device_proxy_test does not run under Wine here). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
|
Thank you, that is exactly the kind of failure I cannot see from here: Your patch is applied as its own commit on this branch ( AI-assisted. |
…t of their block The slot 25/26 cases added before this block call slot 26 four times, so its absolute counts (3, then 4) failed on Windows. The counts are now increases from the block's start, and the forwarding check no longer shares a line with a counter, so a counter failure is not reported as a forwarding failure. Patch by BadgersMC, from the review of ProjectLeonida#362 (found and tested on native Windows with WARP; device_proxy_test does not run under Wine here). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
Claimed in #14 as
RT-SLOT25. Depends on: #349, #350, #356 (their commits are the first three here; this pull request is the last two).What and why
After #356 the retail boot stops with a host access violation at device slot 25,
GetResourceAllocationInfo. It is slot 26's twin (#349): a method that returns a struct, called by the title with the buffer for the struct in RCX and the device in RDX, whilemain's forwarder takes RCX for the proxy.5dbc30bedby sneylol (-x, authorship kept; an ancestor ofmainwhose content is not in the tree) adds thunks for slots 25 and 26 that accept either form: whichever of the first two arguments is the device proxy isthis. Slot 26 already has its thunk from d3d12_xs: device slot 26 takes the console's struct-return form, again (RT-SLOT26) #349, so only slot 25's is installed here; the commit message says so.xs_proxy_mock_testgets a case for slot 25 in both forms. The original commit tested it indevice_proxy_test, which I cannot run (it stops atD3D12XboxCreateDevice returns a deviceunder Wine, onmaintoo).Not included: the later guard for a stale vtable pointer in the title's return buffer (
4154ab0a6, TreXito). It builds on this and can follow.Measured
Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off, on
mainece4ba5b3, with #142 and #328 applied on top for the boot runs (they are not in this branch).--runint3, after device slot 127 is refused as beyond the PC device table (E_NOTIMPL)The D3D12 call count is 1,631 in both:
GetResourceAllocationInfois not one of the traced calls. The next stop is slot 127, the console's committed-resource creation.xs_proxy_mock_testunder Wine passes, with the new case: the buffer in RCX and the device in RDX reaches the PC method with the mask, count and descriptions, only the struct is written and the bytes around it stay; the PC form reaches it too.Not built with MSVC and not run on Windows.
AI-assisted (Claude Code); built and run on the machine above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt