Skip to content

d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 - #6953

Open
Pipodi wants to merge 1 commit into
ItsNotRexed:mainfrom
Pipodi:xs-slot-table
Open

Pipodi wants to merge 1 commit into
ItsNotRexed:mainfrom
Pipodi:xs-slot-table

Conversation

@Pipodi

@Pipodi Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #6750 (comment) (item 1, from the RT-5 boot measurement in #6915)

What and why

The retail executable calls Xbox device slot 133. The d3d12_xs device proxy's vtable had 128 entries, so that call read past the table and jumped to address 0 (an access violation at rip 0) instead of reaching the generic thunk that refuses unknown slots. kMaxSlots is now 192, with a static_assert that it covers 133. Every slot past the PC device's vtable is now refused with E_NOTIMPL and logged once, as the file already intends.

The queue, fence and allocator proxies (kQueueSlots, kFenceSlots, kAllocatorSlots) and the 11-slot heap proxy have the same fixed-size shape. Their tables refuse slots past the real object's count, but a call past the table itself would still go through an empty entry. I haven't seen the title do that yet, so they're left as they are.

Tested

AI-assisted: yes (Claude Code)

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: runtime only)

🤖 Generated with Claude Code

…e PC vtable refuse with E_NOTIMPL

The retail title calls device slot 133, past the 128-entry table; the call read an empty entry and jumped to 0.
Every slot beyond the PC device's vtable now reaches the generic thunk. Mock test covers slot 133.

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

Copy link
Copy Markdown

Tested 4b76715 on NVIDIA GeForce RTX 5090, driver 617.42, Windows 11 (26200), MSVC 2022 RelWithDebInfo: pass.

  • ctest -R ^xs_proxy_mock: 4/4 pass (xs_proxy_mock, _no_reserve, _no_protect, _no_handler), at the PR head and merged locally onto current main (no conflicts).
  • Code read: the vtable is still filled with make_index_sequence<kMaxSlots>, so slots 128–191 get the generic thunk; g_hits/g_first/g_beyond_warned are sized by the same constant and the slot >= kMaxSlots guards are unchanged. Nothing else is touched.
  • Small note: the new check asserts mock->calls[127] == 0 after calling slot 133. I read that as "the call didn't reach a real slot", but a check on slot 133's own refusal count (the g_hits side) would pin the exact slot, if the mock exposes it.
  • Not checked: the retail title reaching slot 133 under gta6rt --run (I don't have the earlier stops' local stand-ins in place).

AI-assisted (Claude Code).

@Raavve

Raavve commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 4b76715c on Windows 11, RTX 4060, driver 610.88, own 1.0.2.1 copy (exe SHA-256 matches the published one), stacked on main 1cc6e3c12 + #6792 + #6582 + #4313 + #4348 + #6919 (c9c90632) + #6964 (86b8e04e) (MSVC, RelWithDebInfo, LEONIDA_D3D12=vulkan, LEONIDA_UNIMPLEMENTED=stop):

AI-assisted, outcomes only.


Generated by Claude Code

@pvfreis

pvfreis commented Nov 23, 2026

Copy link
Copy Markdown

Tested 4b76715 on NVIDIA GeForce RTX 3060 (driver 617.14), Windows 11 (26300), MSVC 19.44.35229 (v143) + Ninja, RelWithDebInfo: pass.

  • ctest -R ^xs_proxy_mock: 4/4 pass (xs_proxy_mock, _no_reserve, _no_protect, _no_handler) at the PR head.
  • Negative control: with kMaxSlots set back to 128 (and the new static_assert removed), the new slot-133 check makes xs_proxy_mock fail with SEGFAULT. With 192 it returns E_NOTIMPL. So the test catches the regression the PR describes.
  • On the earlier note about mock->calls[127]: the mock has kMockSlots = 128, so it has no slot 133 to count. Index 127 is its last slot, and the E_NOTIMPL result plus the no-crash path is the meaningful part of the check.
  • Not checked: the merge onto current main, or the retail title under gta6rt --run.

AI-assisted (Claude Code).

@kapitche

Copy link
Copy Markdown
Contributor

Tested 4b76715 merged with main e6190e7 (which already has #6935) on Windows 11 / RTX 4080 SUPER against own copy of the retail exe: pass

  • Build: MSVC 14.51 (VS 18), Ninja, RelWithDebInfo, gta6rt + device_proxy_test + xs_proxy_mock_test. The merge is clean.
  • ctest -R "device_proxy|xs_proxy_mock": 8/8 passed.
  • Negative control: main's runtime/shims/d3d12_xs_device.cpp with the PR's tests makes xs_proxy_mock crash (SegFault, the jump through the empty slot) and leaves the other 7 passing. With the PR's file restored, all 8 pass again.
  • gta6rt --dry-run (LEONIDA_D3D12=vulkan, fresh --trace, --trace-d3d12, --overlay to a scratch folder): main and the PR both have 30 unimplemented imports, with the same list (expected, since the change is in the proxy).
  • gta6rt --run with LEONIDA_UNIMPLEMENTED=stop: same as main, exit 3 at the first unimplemented import (D3D12ConfigureVirtualMemoryX) before D3D12XboxCreateDevice. Slot 133 is not reached in a main-only stop-mode run. On a newer main (b66e184, with d3d12_xs: D3D12ConfigureVirtualMemoryX shim (first unimplemented call of the title) #6792), --run now stops at an int3 in the title after 3 xmem_attributes events, which is still before device creation.

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.

5 participants