Skip to content

d3d12_xs: the title's queue slot 18 is the frequency getter, not PC GetDesc (RT-QUEUE18) - #403

Merged
aslan2142 merged 9 commits into
ProjectLeonida:mainfrom
Mumogg:queue-slot18-frequency
Nov 25, 2026
Merged

aslan2142 merged 9 commits into
ProjectLeonida:mainfrom
Mumogg:queue-slot18-frequency

Conversation

@Mumogg

@Mumogg Mumogg commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in #14 as RT-QUEUE18. Depends on: the stack up to #396 (their commits come first here; this pull request is the last commit). The change itself is in the queue proxy and its test.

What and why

This is the cause of the fault I could not explain in #391, #395 and #396.

Command-queue slot 18 is ID3D12CommandQueue::GetDesc on the PC: a struct return that writes a 16-byte D3D12_COMMAND_QUEUE_DESC through its hidden pointer. The retail title calls queue slot 18 with one pointer to 8 bytes. That is the shape of GetTimestampFrequency(UINT64*), which the console queue has at that slot: two methods are inserted at 14 and 15, so the PC slots 16 to 18 sit two later. main forwarded the call as GetDesc, which wrote a description over the title's 8 bytes and the 8 after them.

How I found it: the normalized D3D12 traces of this path and of the integration branch (#321) were the same up to that point except for one extra line here, ID3D12CommandQueue::GetDesc called right after XboxID3D12CommandQueue::GetDesc called.

The change: the title's call goes to the PC slot 16. "The title's call" is decided by the caller classifier device slots 61 and 74 use (set_console_caller), so a host caller, and every caller when no classifier is installed, keeps the PC GetDesc.

Written by me, not cherry-picked. The reading of slot 18 comes from the console queue work of old PR 2490 (Nolan Cotter), which answers an undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That work detects the queue layout at run time and does not apply to main's queue proxy; this is the one rule the boot needs. Slots 19 and 20 are left as they are: I have not seen the title call them.

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 main ece4ba5b3, with #142, #219, #328 and #387 applied on top for the boot runs (they are not in this branch).

--run Traced calls Ends with
up to #396 11,950 the title writing through a null pointer after its first ExecuteCommandLists ok
+ this 11,992 the title's own int3 on another thread, after command-queue slot 32 is refused

What the fault was hiding: after the first submission the title now records on its list (Barrier, ClearRenderTargetView, Barrier), submits again, creates six samplers and five placed resources with their views, and calls queue slot 32, which is PresentX. That is the first present call on this path. It is refused as past the PC queue table, and one ID3D12GraphicsCommandList::Close fails along the way; those are the next two things to look at.

That the overrun is what broke the title is an inference from the forwarded call's shape; what is measured is that the fault is gone with this change and nothing else.

Tests under Wine: xs_proxy_mock_test passes with the new case (the guest call reaches the mock queue's slot 16 with its pointer and leaves the words around it alone; a host call, with a classifier and with none, reaches slot 18). queue_proxy_test passes on the Vulkan backend.

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

DevilNine and others added 5 commits November 24, 2026 03:52
(cherry picked from commit e925b63)

Adapted to main by Mumogg: main has command-list proxies, so the shared execute function replaces them by their
real lists in a copy of the array (UnwrappedArray), for the console slot 35 as for the PC slot 10, whose test
failed otherwise. The slot 35 mock case passes two mock lists instead of two numbers and checks that they arrive
and that the caller's array is not written.
…ow in the Xbox-only table

Asked for in review on ProjectLeonida#377.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
The retail title resets its command lists through list slot 139, with (allocator proxy, pipeline state). main's
slot map had no entry for it, so the call was recorded and dropped and the list stayed closed. The map sends it
to the PC slot 10, and the unwrap keys on the PC slot, so console slot 10 and console slot 139 both hand the real
list its real allocator (and a wrapped pipeline state the same way) and re-pin the inline cursor.

The mapping and the unwrap rule are those of ef9d075 (Nolan Cotter; measured by Pipodi), written again for
main's list proxy, where that commit does not apply. xs_proxy_mock_test checks the map entry and a slot 139 call.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
…etDesc

Queue slot 18 is ID3D12CommandQueue::GetDesc on the PC: a struct return that writes a 16-byte description through
the hidden pointer. The retail title calls slot 18 with one pointer to 8 bytes, the shape of
GetTimestampFrequency(UINT64*), which the console queue has there (two methods are inserted at 14/15, so the PC
slots 16 to 18 sit two later). Forwarded as GetDesc, the call wrote a description over the title's 8 bytes and
what follows them; the title then went wrong a little later, after its first submission.

The title's call (set_console_caller, as device slots 61 and 74) now goes to the PC slot 16. A host caller, and
every caller when no classifier is installed, keeps the PC GetDesc.

The reading of slot 18 is that of the console queue work in old PR 2490 (Nolan Cotter), which answers an
undetected slot 18 as the frequency getter because it is the only reading that cannot overrun its argument. That
work's layout detection does not apply to main's queue proxy; this is the one rule the boot needs, written for
it. xs_proxy_mock_test: the guest call reaches the mock queue's slot 16 with its pointer and leaves the words
around it; a host call, with a classifier and with none, reaches slot 18.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
@Mumogg
Mumogg force-pushed the queue-slot18-frequency branch from e7044cb to 862890c Compare November 24, 2026 09:54
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
aslan2142 and others added 4 commits November 24, 2026 18:41
Two files conflicted; in each, both sides had added something at the same
place and both are kept.

runtime/shims/d3d12_xs_device.cpp: this branch's
queue_execute_command_lists() next to main's XboxQueueSlotRoutes and
xbox_queue_slot_routes() (the PresentX, SuspendX and ResumeX routes).

runtime/test/xs_proxy_mock_test.cpp: main() runs check_xbox_queue_slots()
and then check_presentation_wiring().

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merged on top of the merge made for ProjectLeonida#391 (main 507029d plus RT-QUEUE35).

One conflict, in docs/d3d12_vulkan.md: both sides added a row at the same
place of the Xbox-only table. Both are kept: this branch's
"Command-allocator slot 9" row, then main's "Device slot 81, queue
PresentX/SuspendX/ResumeX" row. The code and the tests merged without
conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merged on top of the merge made for ProjectLeonida#395 (main 507029d plus RT-QUEUE35
and RT-ALLOC9). No conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merged on top of the merge made for ProjectLeonida#396 (main 507029d plus RT-QUEUE35,
RT-ALLOC9 and RT-LIST139). No conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@aslan2142
aslan2142 merged commit b4b7756 into ProjectLeonida:main Nov 25, 2026
4 of 5 checks passed
@aslan2142

Copy link
Copy Markdown
Collaborator

Merged. Mumogg is still away and this is the next rung on main's boot path, so I brought the branch up to date as with the rungs before it: one merge commit on top of 862890c89 (fb2afdccc), merging main with #391, #395 and #396 in it. Mumogg's commit is untouched and nothing was force-pushed. There were no conflicts.

What it does: queue slot 18 is the frequency getter for the title's calls. A caller in a guest-mapped image goes to the PC slot 16 (GetTimestampFrequency(UINT64*)); a host caller, and every caller when no classifier is installed, keeps the PC GetDesc. The check is is_console_caller, as for device slots 61 and 74. This stops the PC GetDesc writing 16 bytes over the title's 8-byte argument, which by Mumogg's reading is what broke the title after its first submission.

How it is known: the mapping agrees with the console queue table Kokonotcu posted in #14 (#14 (comment)): 16 Signal, 17 Wait, 18 frequency, 19 GetClockCalibration, 20 GetDesc. What this PR measures itself is that the fault goes away; that the overrun was its cause is an inference, as the PR says.

Holds and requests: none on this PR.

Tests (clang-cl with the xwin SDK; Wine, headless; llvmpipe and an RDNA2 iGPU):

  • Full Windows suite under Wine, the branch against main with d3d12_xs: console list slot 139 is Reset (RT-LIST139) #396: no test changed state on either device (259 pass and 15 fail on llvmpipe, 255 and 21 on the iGPU, on both sides).
  • queue_proxy, xs_proxy_mock with its six variants and device_proxy pass on both devices.
  • check_no_game_data.py on the two changed files is clean. The Linux portable subset does not build these files.
  • Not run here: MSVC, native Windows, and the game itself. Mumogg's run goes from 11,950 to 11,992 traced calls with this, and then stops because queue slot 32 (PresentX) is refused.

For later:

Next: #414 (PresentX). It needs more than a merge: main already routes PresentX (default slot 30, moved with LEONIDA_XS_PRESENT_X_SLOT) and has attach_xbox_presentation, which nothing calls yet, while #414 hard-codes slot 32 with a presentation path of its own. What main lacks and #414 brings is the token source shared between device slot 80 and the pacer, and the code that creates the presenter.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).

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

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants