Skip to content

d3d12_xs: implement console ListProxy with cursor pinning and queue unwrapping - #9525

Merged
ItsNotRexed merged 2 commits into
ProjectLeonida:mainfrom
SalahEddineken:feat/console-command-list-routing
Nov 23, 2026
Merged

ItsNotRexed merged 2 commits into
ProjectLeonida:mainfrom
SalahEddineken:feat/console-command-list-routing

Conversation

@SalahEddineken

Copy link
Copy Markdown
Contributor

Relates to #313 (Replaces reverted #2490)

Summary

  • Implements ListProxy for Xbox-ABI command lists returned by slot 73 (CreateCommandListX) with a 160-slot vtable and inline cursor pinned to limit (+0x18, +0x28, +0x30).
  • Preserves unwrapped native PC-shaped command lists on device slot 12 (CreateCommandList) so desktop test harnesses (run_tiny_frame, tiny_frame.cpp) keep slot 48 (ClearRenderTargetView) working without regression.
  • Maps console list slots:
    • 0..26: PC order
    • 27..30: unforwarded console extras
    • 31: ExecuteBundle (unwraps bundle command list proxy)
    • 32: SetDescriptorHeaps (unwraps heap proxies via UnwrappedArray)
    • 33..59: shifted +4 to PC slots 29..55
    • 60: EndEvent -> PC slot 58
    • 61: ExecuteIndirect -> PC slot 59
    • 85: CopyTextureRegionX -> PC slot 16
    • 146: Barrier -> PC slot 80 (ID3D12GraphicsCommandList7)
    • 148: AllocateUploadMemory stub (returns null, logged once)
    • 10: Reset unwraps allocator proxy and re-pins inline cursor
  • Unwraps command list proxies in queue slot 10 (ExecuteCommandLists).
  • Adds comprehensive unit tests in runtime/test/xs_proxy_mock_test.cpp.

Verification

  • xs_proxy_mock_test.exe: PASS
  • python -I scripts/check_no_game_data.py: PASS (0 violations)
  • python -I tests/test_report_paths.py: PASS (22 tests OK)
  • AI-assisted: Yes. Tested offline with MSVC v19.44 / C++20 on Windows 11.

…nwrapping

- Implement ListProxy for Xbox-ABI command lists returned by slot 73
  (CreateCommandListX) with 160-slot vtable and inline cursor pinned to limit
- Keep slot 12 (CreateCommandList) returning unwrapped PC-shaped list so
  desktop test harnesses (run_tiny_frame, tiny_frame.cpp) keep slot 48
  (ClearRenderTargetView) working without regression
- Route console command list slots:
  * 0..26: PC order
  * 27..30: unforwarded console extras
  * 31: ExecuteBundle (unwraps bundle command list proxy)
  * 32: SetDescriptorHeaps (unwraps heap proxies via UnwrappedArray)
  * 33..59: shifted +4 to PC slots 29..55
  * 60: EndEvent -> PC slot 58
  * 61: ExecuteIndirect -> PC slot 59
  * 85: CopyTextureRegionX -> PC slot 16
  * 146: Barrier -> PC slot 80 (ID3D12GraphicsCommandList7)
  * 148: AllocateUploadMemory stub (returns null, logged once)
  * 10: Reset unwraps allocator proxy and re-pins inline cursor
- Unwrap command list proxies in queue slot 10 (ExecuteCommandLists)
- Add comprehensive mock tests verifying routing, pinning, and unwrapping
@VibeClauding

Copy link
Copy Markdown

Before anyone spends review time on this, some context. #2490 is not gone. It was merged and then reverted on main (57c175391, "breaks run_tiny_frame (please rebase and split)"), but the pull request is open again with a newer head (084c8bd09, updated today, its title adding a "PC-list fixture path"). It is in the boot-path merge order in #8851, and boot stacks are measuring it today (bobczan's A/B on #2490). The maintainers' integration branch (git.notrexed.dev/enx/leonida) has also imported it as 79fb37d3a, with follow-ups 13da4634e, c751b64a8 and c0da626c3. So this PR re-implements a list proxy that is live in two places, and it will conflict with both.

One functional difference matters for the title: console list slot 148 (AllocateUploadMemory). Here it returns 0 ("stub ... returns 0 without faulting"). #2490 and forge main serve it from an upload arena, because on the console the title writes its data through the returned pointer, so a null makes the title write through null on its first upload.

If the point of this PR is the run_tiny_frame breakage behind the revert (keeping slot-12 PC lists unwrapped), that would land better as a checked: or a fix on #2490 itself. That matches the "one PR, help on the existing one" rule in #8851.

AI-assisted (Claude Code).

@OliverMarcusson

Copy link
Copy Markdown

Tested d90903a6 (merged cleanly onto main 5d74c272) on Windows 11 10.0.26200 (RTX 5070 Ti), MSVC 19.44 (RelWithDebInfo, Windows SDK 10.0.26100.0): pass.

  • ctest -C RelWithDebInfo -R ^(xs_proxy_mock|device_proxy)$: 2/2 PASS
    • device_proxy_test: OK (0 failures) (0.05 s)
    • xs_proxy_mock_test: PASS (9 allocations refused on purpose) — console command list routing, cursor pinning, queue unwrapping, and slot mapping passed (0.02 s)
  • Code read of ListProxy layout (static_assert(offsetof(ListProxy, console_fields) == 0x18)), cursor pinning at +0x18/+0x28/+0x30, and queue ExecuteCommandLists unwrapping looks clean.

AI-assisted (Gemini).

@jebaczydow

Copy link
Copy Markdown

Read the diff against docs/d3d12_command_objects.md (not run). Two things in the console-to-PC list mapping look like they contradict the repo's own measurements:

  1. console_to_pc_list_slot sends every slot 31..59 to slot - 4, so console 59 goes to PC 55 (SetPredication). The doc's row for console slot 59 (+0x1d8) says "console only (shape)": (1, blob, size) at 0x6b5a and 0x6d53, the blob a run of qwords, which is not a SetPredication(buffer, offset, op) call. The doc also says the console lacks two of the slots between 56 and 60 (console 55 is at +4, console 61 at +2), so the shift cannot be a flat 4 up to 59. Slots 56..58 are forwarded to BeginQuery/EndQuery/ResolveQueryData with no source either. The test pins only 60 and 61.

  2. Reset (console slot 10) calls pin_cursor_at_limit(), which sets the write cursor to the limit so a title's inline writers fall back to a call. The doc (section 3.3a, "It is the inline form of console slot 80") says that fallback is console slot 80, (x, 1, 1, W), a Dispatch with one extra word (inferred, not measured). In this PR slot 80 is not mapped (console_to_pc_list_slot falls through to kListNotForwarded) and the thunk returns 0, logging only for slot 148. So with the cursor pinned, every inline dispatch on a console list would be dropped without a message. Is slot 80 meant to come in a follow-up? If not, forwarding it as Dispatch(x, 1, 1), or at least logging its first call, would avoid a silent loss.

AI-assisted (Claude); code read only, nothing run.

@BatSmacker84

Copy link
Copy Markdown

Tested d90903a63 merged onto main 5d74c2723 on AMD Radeon RX 7800 XT, driver 26.11.2, Windows 11 26200, MSVC 19.44 + Ninja RelWithDebInfo: pass.

  • Built gta6rt, xs_proxy_mock_test, tiny_frame and d3d12_com_test. ctest -R '^(xs_proxy_mock|run_tiny_frame)': 8/8, including both Vulkan tiny-frame runs.
  • test_report_paths.py: 21 passed, 1 skipped.
  • Control: the new mock doesn't compile against main, because the list-proxy APIs it tests are absent there.

AI-assisted: Codex GPT-6.2 Sol ran the builds and tests, Claude Opus 5.5 reviewed the report. Synthetic fixtures only, no game data.

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.

6 participants