Skip to content

d3d12_xs: route command queue slot 35 to ExecuteCommandLists - #7286

Open
Vadson159 wants to merge 1 commit into
ItsNotRexed:mainfrom
Vadson159:recomp/queue-slot-35-execute
Open

Vadson159 wants to merge 1 commit into
ItsNotRexed:mainfrom
Vadson159:recomp/queue-slot-35-execute

Conversation

@Vadson159

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #7049 (comment)

Depends on: none (applies directly to main; sharing queue_execute_command_lists between slots 10 and 35 also keeps future command-list unwrapping such as #7076/#2490 in one place).

What and why

Per @KkelebekK's RT-5 measurement (#7049 (comment)), the retail executable calls command queue slot 35 as (count, lists) — a console ExecuteCommandLists variant, not PresentX. Previously ChildProxy<ChildKind::queue> only forwarded slots 0..18 (kQueuePublicSlots = 19) and refused slot 35 with E_NOTIMPL.

  • runtime/shims/d3d12_xs_device.cpp / runtime/shims/d3d12_xs_device.h:
    • Route ChildKind::queue slot 35 (kQueueExecuteCommandListsX) to PC slot 10 (kQueueExecuteCommandLists) via a shared queue_execute_command_lists helper, zero-extending UINT count cleanly to 64 bits and returning 0 (S_OK / ignored void).
    • Record slot 35 as XboxID3D12CommandQueue::ExecuteCommandListsX in child_public_name<ChildKind::queue> / d3d12_trace and expose queue_slot_overridden(unsigned slot).
  • runtime/test/queue_proxy_test.cpp:
    • Exercise queue slot 35 on both empty command lists (check_slots) and a GPU upload -> default -> readback copy round-trip with readback verification (check_xbox_client), plus queue_slot_overridden checks and skipping overridden slots in the E_NOTIMPL tail loop.
  • runtime/test/xs_proxy_mock_test.cpp:
    • Add check_xbox_queue_slots() verifying queue_slot_overridden, slot 35 hit/first-call tracking, routing to mock PC slot 10 without reaching mock slot 35, upper-32-bit garbage masking on count, and skipping overridden slots in check_tail.

Tested

Windows 11, MSVC (RelWithDebInfo), AMD Radeon RX 9070 XT + WARP + Vulkan, no game files:

  • scripts\build_runtime.ps1: clean incremental build (113/113 targets, gta6rt.exe linked).
  • .\runtime\build\queue_proxy_test.exe --trace-d3d12: 3 backend(s) passed (host WARP, host AMD Radeon RX 9070 XT, Vulkan).
  • .\runtime\build\xs_proxy_mock_test.exe: xs_proxy_mock_test: PASS (9 allocations refused on purpose).
  • ctest --test-dir runtime/build -C RelWithDebInfo -R "proxy|allocator|root_sig|loader|xmem|frame_pacer|tiny|d3d12_xs|dxgi_device|xbox_present" --output-on-failure: 39/39 passed (0 failed).
  • python -I scripts/check_no_game_data.py runtime/shims/d3d12_xs_device.h runtime/shims/d3d12_xs_device.cpp runtime/test/queue_proxy_test.cpp runtime/test/xs_proxy_mock_test.cpp, git diff --check, and LF line-ending check: clean.
  • Not tested locally: VK_LAYER_KHRONOS_validation (layer not installed on this host) and the retail executable itself (no game files).

AI-assisted: yes.

@soldsawn

Copy link
Copy Markdown

Independent Windows 11 / MSVC check at head e925b63455:

  • Environment: Windows 11, MSVC 19.44.35230.0 (CMake + Ninja, RelWithDebInfo), NVIDIA GeForce RTX 4060 Laptop GPU (driver 32.0.16.1714).
  • Built targets: queue_proxy_test, xs_proxy_mock_test, device_proxy_test, gta6rt — all built cleanly.
  • Test results:
    • queue_proxy_test.exe: 3 backend(s) passed (including queue slot 35 ExecuteCommandLists GPU execution & readback).
    • xs_proxy_mock_test.exe: PASS (9 allocations refused on purpose) (queue slot 35 routes ExecuteCommandLists(count, lists) to PC slot 10 with UINT count masking).
    • device_proxy_test.exe: OK (0 failures).

AI-assisted.

@MartinIndra02

Copy link
Copy Markdown

Independent Windows + GPU test of e925b6345: pass.

Setup: Windows 11 x64, MSVC 19.44.35220 (RelWithDebInfo, Windows SDK 10.0.26100.0), NVIDIA GeForce RTX 3080 (driver 32.0.16.2124 / 621.24), Vulkan SDK 1.4.363.1, no game files.

  • xs_proxy_mock_test.exe: PASS (exit 0) — check_xbox_queue_slots (slot 35 routing to PC slot 10, UINT count upper-32-bit masking, queue_slot_overridden) and tail checks passed.
  • queue_proxy_test.exe --trace-d3d12 (host WARP, host RTX 3080, Vulkan RTX 3080): 3 backend(s) passed (exit 0), trace confirms XboxID3D12CommandQueue::ExecuteCommandListsX -> ID3D12CommandQueue::ExecuteCommandLists ok and GPU copy readback round-trip through slot 35.

AI-assisted review/test.

@TheHoracio

Copy link
Copy Markdown
Contributor

Integration note (AI-assisted; no game files): with #2490 merged, the early return for queue slot 10 skips #2490's list-proxy unwrapping.

child_slot now returns queue_execute_command_lists(self, a1, a2) for Slot == kQueueExecuteCommandLists before the UnwrappedArray block that replaces each console list proxy with its real list. With #2490 the lists a title (or allocator_proxy_test/queue_proxy_test) records come from the device proxy as console-shaped proxies, so the PC queue gets proxy pointers: allocator_proxy fails (readback->Map after the copy, later an access violation) and queue_proxy fails second->GetCompletedValue() == 0 on host WARP. Both pass on main and on #2490 alone.

Unwrapping inside queue_execute_command_lists fixes both slots (10 and your 35) and keeps your count masking:

UnwrappedArray unwrapped;
if (!unwrapped.fill(lists_word, static_cast<std::uint64_t>(static_cast<UINT>(count_word))))
    return hr_to_u64(E_OUTOFMEMORY);
if (unwrapped.data()) lists_word = unwrapped.data();

The slot 35 mock test then needs null (or real mock) entries instead of 0x12340000/0x56780000, since the entries are read, and args[10][1] is the unwrapped copy rather than the caller's array. Whichever of #2490/#7286 lands second needs this.

@jlric

jlric commented Nov 23, 2026

Copy link
Copy Markdown

Retail confirmation of the #2490 integration issue on CachyOS / Wine 11.22, RTX 4070 (620.73.04). Routing slot 35 reaches the PC queue, which rejects the wrapped list. Unwrapping it with list_proxy_real_list before the Vulkan queue resolves the list changes ExecuteCommandLists from failure to success on the same stack. AI-assisted testing.

@rafaelpssz

Copy link
Copy Markdown
Contributor

Retail data point for this (my own 1.0.2.1 copy, Windows 11 + RTX 3060, integration tree with the boot PRs; #7496 comment 7107949979). Forwarding slot 35 to ExecuteCommandLists is what got the title's frames executing on my run: about 311 k ExecuteCommandLists in 90 s, against none before. Two things from the title's two call sites (read statically):

@TheHoracio

Copy link
Copy Markdown
Contributor

Tested e925b6345 on AMD Radeon RX 7800 XT (RDNA3), Windows 11, MSVC 2022 RelWithDebInfo: pass on its own. scripts/build_runtime.ps1 and the device/proxy subset of ctest (incl. queue_proxy, allocator_proxy, xs_proxy_mock): 26/26. No game files. (AI-assisted run.)

As noted above, it only breaks once #2490's console list proxies are in (the early return skips the list unwrapping); the UnwrappedArray fix in my previous comment keeps this result and makes the combination pass too.

@myokex

myokex commented Nov 23, 2026

Copy link
Copy Markdown

Tested e925b6345 on Windows 11, AMD Radeon RX 7800 XT (RDNA3, driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, CMake 4.4.4, Vulkan SDK 1.4.363.0; merged alone onto main 042c5f378, full ctest -j8; synthetic, no game files: pass. queue_proxy, xs_proxy_mock and its five variants pass. The 5 failures main itself has on this card (vk_queue_query_sync, d3d12_vulkan_device, d3d12_texture_tiles, d3d12_indirect_dispatch_count, d3d12_pipeline_library_host, see #166) fail the same way with and without this PR. d3d12_bindless_churn (or _validated) failed once in this run; it is a flake under parallel ctest -j8 here, not this PR: it also failed with unrelated PRs, and on main it passes 10/10 run alone (--repeat until-fail:10). AI-assisted (Claude Code).

@AAyberkU

Copy link
Copy Markdown
Contributor

Measured on the retail executable (own 1.0.2.1 copy, native Windows 11, RTX 5060 Ti, LEONIDA_D3D12=vulkan, a local integration tree with this PR, #2490, #7076-era list proxies and the other open boot-chain PRs). Slot numbers and counts only.

queue_execute_command_lists hands the title's list array to the real queue as it is. The title's lists come from device slot 73, so they are list proxies (#2490), and the Vulkan layer refuses each one: the run logs list proxy refuses {2F8A7C33-...}, which the real object implements; E_NOINTERFACE, then ExecuteCommandLists: list 0 is not a direct command list, and ID3D12CommandQueue::ExecuteCommandLists failed on every slot 35 call.

Unwrapping the array the way slot 10 already does fixes it here (every slot 35 submit then traces ExecuteCommandLists ok):

std::uint64_t queue_execute_command_lists(ChildProxy* self, std::uint64_t count_word, std::uint64_t lists_word) {
    using ExecuteFn = void(WINAPI*)(void*, std::uint64_t, ID3D12CommandList* const*);
    UnwrappedArray unwrapped;
    if (!unwrapped.fill(lists_word, count_word)) return 0;
    if (unwrapped.data()) lists_word = unwrapped.data();
    reinterpret_cast<ExecuteFn>(self->real_vtable[kQueueExecuteCommandLists])(
        self->real, static_cast<std::uint64_t>(static_cast<UINT>(count_word)),
        reinterpret_cast<ID3D12CommandList* const*>(lists_word));
    return 0;
}

Happy for you to fold it in; I won't open a separate PR for it. AI-assisted (Claude Code).

@Daysonnn

Copy link
Copy Markdown

I tested the 256-list batch size reported in this thread on PR head e925b634551ed96d1ed097dfe17d7dfca0cdbe4d. I added a synthetic readback case to queue_proxy_test. It submits 256 distinct direct command lists through queue slot 35 in one call (token 0, flags 3). Each list copies one unique 32-bit value into its own previously checked destination word. After the fence completes, the test checks all 256 words.

All four runs returned 256/256 on each backend:

  • Direct3D 12 on NVIDIA GeForce RTX 4070 SUPER, driver 621.24
  • Leonida's Vulkan backend on the same GPU, Khronos validation 1.4.357 enabled, zero validation errors
  • Direct3D 12 on WARP (software)

As a negative control I changed only the submitted count to 255 and kept all 256 expected words. WARP reported the first mismatch at index 255 and exited 1. Restoring the count to 256 passed again on all three backends.

Windows 11 26H2, MSVC 19.51.36263, RelWithDebInfo. This tests batch delivery with PC-interface command lists on this PR in isolation. The #2490 wrapped-list integration and retail startup are outside this measurement. All inputs were synthetic. AI-assisted.

To reproduce with the patch and the Vulkan SDK installed, from the repository root on Windows:

git apply Leonida-7286-queue-batch.patch
cmake -S runtime -B build -A x64 -DLEONIDA_REQUIRE_VULKAN=ON
cmake --build build --config RelWithDebInfo --target queue_proxy_test
$env:LEONIDA_VK_VALIDATION = '1'
.\build\RelWithDebInfo\queue_proxy_test.exe --xbox-client

Leonida-7286-queue-batch.zip

zneel added a commit to zneel/Leonida that referenced this pull request Nov 23, 2026
Queue slot 35 (console ExecuteCommandLists) goes through the fork's list-proxy
unwrapping: ItsNotRexed#7286 forwarded the caller's array to PC slot 10 as it was, which
would hand console list proxies to the real queue, and its slot-10 shortcut
skipped the existing unwrapping (removed). The console queue tail stays S_OK; the
mock check passes real objects instead of marker pointers, since entries are read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Stalkerino

Copy link
Copy Markdown

I tested the console queue path with retail 1.0.2.1 on Linux under Proton CachyOS 11.0-20261015, Gamescope and an RX 9070 XT (RADV). In our #2490 + #7880 integration, all 586 command-list Close calls succeeded, but slot 35 reached the console-only handler and the runtime recorded zero PC ExecuteCommandLists calls.

I then integrated the routing from e925b6345 and used the same array unwrapping as slot 10, as described in the Windows retail test. In two independent Proton launches the trace showed two Xbox ExecuteCommandListsX calls followed by two successful PC ExecuteCommandLists calls. All 586 Close calls still succeeded. The Vulkan queue proxy test also passed, including the GPU copy/readback.

The game presented one plane and still stopped at Game Init, engine frame 0. The visible window remained black, with no DrawInstanced or DrawIndexedInstanced in either trace. This validates the submission step on RADV. AI-assisted testing.

@Cresceda

Copy link
Copy Markdown

Merge note from a local integration, in case this lands together with #7076 (the console list proxy from #2490):

queue_execute_command_lists here calls the PC slot 10 with the caller's array as it is. With #7076 in the tree, queue slot 10 is where the list array gets unwrapped (an UnwrappedArray with each list proxy replaced by its real list). This PR also sends the PC slot 10 through queue_execute_command_lists, so both slot 10 and slot 35 would hand list proxies to the real queue.

What worked locally:

  • unwrap inside queue_execute_command_lists: fill an UnwrappedArray from (lists, count) and pass its data on, so slots 10 and 35 share it;
  • in check_xbox_queue_slots, pass two readable mock lists instead of 0x12340000/0x56780000 (the unwrap reads each entry), and since the PC slot now gets a copy, record slot 10's array in the mock and compare the entries rather than the pointer.

With that, the retail boot's first ExecuteCommandListsX reaches the real queue and the frame loop runs (about 340 submissions with LEONIDA_STUB_PIPELINES), on Windows 11 26200, RTX 4070 SUPER (NVIDIA 616.56), Ryzen 7 5700X3D. All proxy tests pass, queue_proxy included.

Outcomes only, no game data. AI-assisted (Claude Code).

@zebraso

zebraso commented Nov 23, 2026

Copy link
Copy Markdown

tried: #7286 (behaviour integrated locally, not a competing PR) | for: command queue slot 35 | base: main@0656b0b + the open boot-chain PR heads and local shims | on: Windows 11, RTX 5080, 32.0.16.1714 | result: past the slot; 126,913 ID3D12CommandQueue::ExecuteCommandLists ok and 126,912 draws in a 300 s run, with the list proxies unwrapped through the existing UnwrappedArray; the PresentX window remains hidden, so the next stop is the visible present, not the submit | agent: yes

@lunarminus

Copy link
Copy Markdown

Retail boot result and a merge note. Wine 11.22 on an AMD Radeon 760M (RADV Mesa 26.3.1), my own 1.0.2.1 executable, gta6rt cross-built with clang-cl 23.1.5 + xwin.

Merge note for a stack with #2490's list proxies:

AI-assisted (Claude Code).

@MarcPique

Copy link
Copy Markdown

Windows retail integration check of the slot-35 routing. Base: ASTROWwwW's ladder-frame@a1751a9f0 + #7604 for the slot-25 allocation stop. Windows 11 (26200), MSVC 19.44.35228, RTX 4090 / 32.0.16.1656, Vulkan backend, offline.

  • Control (210 s): 336,756 queue slot-35 calls logged as console-only. The game recorded 168,378 draws and the visible window captured white.
  • With the d3d12_xs: route command queue slot 35 to ExecuteCommandLists #7286 route adapted to the branch's existing list proxy: the slot-35 path masks the count to UINT and reuses slot 10's command-list unwrapping. Over 240 s, 490,428 calls reached the real ExecuteCommandLists and returned through the backend's success path. No failed command-list Close or guest exception was logged.
  • This run also selected the actual title window with shims: find_title_window, the title's own window that PresentX shows its frames in #8591. It recorded 245,213 successful PresentX calls and the captured client area was uniformly black. The menu remained missing.
  • The integrated queue_proxy CTest passed. Both runs ended at their external test limits.

This confirms the slot-35 submit route on a retail boot. The window-selection change was included in the same run, so this comparison does not isolate effects on the picture.

wcd6 added a commit to wcd6/Leonida that referenced this pull request Nov 23, 2026
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/queue_proxy_test.cpp
#	runtime/test/xs_proxy_mock_test.cpp
wcd6 added a commit to wcd6/Leonida that referenced this pull request Nov 23, 2026
…lists (RT-5 stop 25)

Two integration gaps between ItsNotRexed#7286 (ExecuteCommandListsX) and ItsNotRexed#2490's
console list proxy, as retail_boot_frame_loop.md section 3 describes:

- The console-only fallback for queue slots past the public chain ran
  before ItsNotRexed#7286's slot 35 handler, so ExecuteCommandListsX was answered
  S_OK and nothing reached the queue. Slot 35 is now excluded from it.
- queue_execute_command_lists passed the title's array, which holds list
  proxies, straight to the real queue (slots 10 and 35 both reach it
  before the slot-10 unwrapping). It now hands over an UnwrappedArray copy
  with the real lists.

Measured with --run --trace: the title's first ExecuteCommandListsX
reaches the Vulkan queue (ExecuteCommandLists ok, with a
ClearRenderTargetView) instead of 13 console-only no-ops.
tibzejoker added a commit to tibzejoker/Leonida that referenced this pull request Nov 23, 2026
Queue slot 35 (ExecuteCommandListsX) is served before the console-only S_OK answer, next to fence slot 12 and allocator slot 9. Slots 10 and 35 share one path that unwraps list proxies (ItsNotRexed#2490), so the PR's mock check uses real objects and compares the array the real queue got. Tail loops skip the overridden queue slots. queue_proxy_test: the fence slot 12 block is back to the PR's value 9 (the fence is already at 9 there; 8 was a backwards signal).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@XIIYAZ

XIIYAZ commented Nov 23, 2026

Copy link
Copy Markdown

Retail boot test (RT-5): own 1.0.2.1 copy, Windows 11, i9-12900KF (Intel, no SSE4a/CLZERO/MONITORX), RTX 3070 (NVIDIA 617.42), MSVC 2022 RelWithDebInfo, LEONIDA_D3D12=vulkan, network shimmed (#6943), OBS/RTSS layers disabled. Local integration on main dde82f27e with about 35 open PRs (the boot chain through #7235, #7858, #7163, #3777, #7115, #7323, #8529, #7201, #7111, #7403, #7290, #7949, #7286, #7880). Counts and outcomes only.

Integration bug with #2490. queue_execute_command_lists() forwards the title's list array as-is, and this PR also routes the public slot 10 through it, so it skips #2490's UnwrappedArray (slot 10 used to replace each list proxy with its real list). Merged together, every ExecuteCommandLists hands console list proxies to the real queue: list proxy refuses {2F8A7C33-...}, which the real object implements; E_NOINTERFACE then ExecuteCommandLists failed and the next Close failed. Unwrapping at the top of queue_execute_command_lists (UnwrappedArray unwrapped; if (!unwrapped.fill(lists_word, count_word)) return hr_to_u64(E_OUTOFMEMORY); if (unwrapped.data()) lists_word = unwrapped.data();) fixes it: 0 failed executions, the title's first frame (reset, heaps, barrier, clear, execute) runs. Also: in the queue thunk, the slot 35 branch must come before #2490's console-tail branch, which answers every slot past the PC table with S_OK.

AI-assisted test run.

@pvfreis

pvfreis commented Nov 23, 2026

Copy link
Copy Markdown

checked: #7286e925b63 | with: gta6rt gta6rt_d3d12_com queue_proxy_test xs_proxy_mock_test, ctest -R "xs_proxy_mock|queue_proxy" | on: Windows 11 26H2 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo, RTX 3060 617.14 | result: pass, 7/7 (queue_proxy on the RTX 3060)
negative control: targeted (the tests use the new queue_slot_overridden): Slot == kQueueExecuteCommandListsX at d3d12_xs_device.cpp:1006 changed to Slot == 9999 (slot 35 back to E_NOTIMPL) | result: xs_proxy_mock and queue_proxy fail, so the tests catch the change

AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.