d3d12_xs: device slot 74 returns S_OK instead of reaching ShaderCacheControl, again (RT-SLOT74) #385

Merged
Mumogg merged 4 commits from upstream-pr/385 into main 2026-11-24 23:16:19 +00:00
Mumogg commented 2026-11-24 04:17:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T04:17:31Z.


Claimed in #14 as RT-SLOT74. Depends on: #349, #350, #356, #362, #369, #375, #377, #383 (their commits come first here; this pull request is the last commit).

What and why

After #383 the title calls device slot 74 once, with (pointer, u32, pointer). main forwards it by number to the PC slot 74, ID3D12Device9::ShaderCacheControl, which reads the first word as its flags and fails; the title then stops on its own int3.

Commit cdeee35aa by tedin7 (-x, authorship kept; an ancestor of main whose content is not in the tree) gives the slot a handler that does not call the PC device, writes nothing through the pointers and returns S_OK. It is a stand-in: what the console call does is not measured, and the commit says so.

The commit also moves the Xbox slot routes into one function (route_xbox_device_slot) so that an environment override which moves a route onto slot 74 wins over the built-in handler. Adapted to main, as the commit message says: inside that function the queue route calls proxy_create_command_queue_xbox, the 32-byte description of #350.

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 and #328 applied on top for the boot runs (they are not in this branch).

--run Traced D3D12 calls Ends with
up to #383 1,657 the title's int3 after ShaderCacheControl fails
+ this 11,916 a call through a null pointer in the host, right after the first call of device slot 108

Of the 11,916, 10,241 are ID3D12Device5::CreateLifetimeTracker, which the layer answers as unsupported; the title goes on regardless. Past this stop the log shows the DirectStorage shim in use (CreateStatusArray, CreateQueue1, zlib requests inflated on the CPU), the first call of device slot 67 (the console's compute pipeline from native code) and of slot 57.

The next stop is device slot 108, past the PC device table. #219 looks like the pull request for it; I will measure it on top of this and report there.

xs_proxy_mock_test under Wine: the default run passes with the new slot 74 case, and --env-slots, --env-slots-invalid and the new --env-slots-74 exit 0.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465990804 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/385). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T04:17:31Z. --- Claimed in #14 as `RT-SLOT74`. Depends on: #349, #350, #356, #362, #369, #375, #377, #383 (their commits come first here; this pull request is the last commit). ### What and why After #383 the title calls device slot 74 once, with `(pointer, u32, pointer)`. `main` forwards it by number to the PC slot 74, `ID3D12Device9::ShaderCacheControl`, which reads the first word as its flags and fails; the title then stops on its own `int3`. Commit `cdeee35aa` by tedin7 (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree) gives the slot a handler that does not call the PC device, writes nothing through the pointers and returns `S_OK`. It is a stand-in: what the console call does is not measured, and the commit says so. The commit also moves the Xbox slot routes into one function (`route_xbox_device_slot`) so that an environment override which moves a route onto slot 74 wins over the built-in handler. Adapted to `main`, as the commit message says: inside that function the queue route calls `proxy_create_command_queue_xbox`, the 32-byte description of #350. ### 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 and #328 applied on top for the boot runs (they are not in this branch). | `--run` | Traced D3D12 calls | Ends with | |---|---|---| | up to #383 | 1,657 | the title's `int3` after `ShaderCacheControl` fails | | + this | 11,916 | a call through a null pointer in the host, right after the first call of device slot 108 | Of the 11,916, 10,241 are `ID3D12Device5::CreateLifetimeTracker`, which the layer answers as unsupported; the title goes on regardless. Past this stop the log shows the DirectStorage shim in use (`CreateStatusArray`, `CreateQueue1`, zlib requests inflated on the CPU), the first call of device slot 67 (the console's compute pipeline from native code) and of slot 57. The next stop is device slot 108, past the PC device table. #219 looks like the pull request for it; I will measure it on top of this and report there. `xs_proxy_mock_test` under Wine: the default run passes with the new slot 74 case, and `--env-slots`, `--env-slots-invalid` and the new `--env-slots-74` exit 0. 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.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
BadgersMC commented 2026-11-24 04:29:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BadgersMC on 2026-11-24T04:29:03Z.


Native Windows check of 25826cdd against its parent 6d4cf2ce (Windows 11 26100, MSVC 19.44, Windows SDK 26100). I queried the level-9 mock device proxy for ID3D12Device9, classified the caller as host, and called ShaderCacheControl(APPLICATION_MANAGED, ENABLE) through the typed interface.

Revision Return Calls received by the mock PC device
6d4cf2ce S_OK 1, with both flags intact
25826cdd S_OK 0

The slot 74 stand-in also intercepts the PC call. Can slot 74 use the caller classification introduced for slot 61 in #383, with a host passthrough test alongside the guest case? The route-override precedence exercised by xs_proxy_mock_env_slots_74 also needs coverage.

All seven xs_proxy_mock* CTest cases passed at 25826cdd. device_proxy and device_proxy_trace failed the slot 25 allocation-info assertions on both revisions. On an RTX 3060 Ti, d3d12_vulkan_device also failed the same tiled resource allocation comparison on both revisions.

AI-assisted. The probe uses a mock PC device. No game files used.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7122061111 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/385#issuecomment-7122061111). Originally posted by [BadgersMC](https://github.com/BadgersMC) on 2026-11-24T04:29:03Z. --- Native Windows check of `25826cdd` against its parent `6d4cf2ce` (Windows 11 26100, MSVC 19.44, Windows SDK 26100). I queried the level-9 mock device proxy for `ID3D12Device9`, classified the caller as host, and called `ShaderCacheControl(APPLICATION_MANAGED, ENABLE)` through the typed interface. | Revision | Return | Calls received by the mock PC device | | --- | --- | --- | | `6d4cf2ce` | `S_OK` | 1, with both flags intact | | `25826cdd` | `S_OK` | 0 | The slot 74 stand-in also intercepts the PC call. Can slot 74 use the caller classification introduced for slot 61 in #383, with a host passthrough test alongside the guest case? The route-override precedence exercised by `xs_proxy_mock_env_slots_74` also needs coverage. All seven `xs_proxy_mock*` CTest cases passed at `25826cdd`. `device_proxy` and `device_proxy_trace` failed the slot 25 allocation-info assertions on both revisions. On an RTX 3060 Ti, `d3d12_vulkan_device` also failed the same tiled resource allocation comparison on both revisions. AI-assisted. The probe uses a mock PC device. No game files used.
Mumogg commented 2026-11-24 04:37:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mumogg on 2026-11-24T04:37:20Z.


You are right, and thank you for testing the host path: the stand-in took a host's ShaderCacheControl as well.

Fixed in 6a9edfe37 on this branch. Slot 74 now asks the same caller classifier slot 61 uses (set_console_caller): a caller in an image the guest loader mapped gets the stand-in; any other caller, and every caller when no classifier is installed, is forwarded to the PC slot 74, or refused past the PC device's table when the device has no slot 74. The route-override precedence is unchanged (--env-slots-74 still passes).

xs_proxy_mock_test has the cases you asked for: the guest case under a classifier, and the host case both with a classifier and with none, on a level-9 device (the call reaches the mock's slot 74 with its words) and on a level-0 one (refused, the mock is not called). It passes under Wine.

Checked on the retail boot as well, since the classifier now decides it: the title's call still gets the stand-in (the slot 74 ... returns S_OK line appears once, no ShaderCacheControl in the trace) and the run reaches the same point as before.

#391, #395 and #396 are rebased onto this.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7122187408 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/385#issuecomment-7122187408). Originally posted by [Mumogg](https://github.com/Mumogg) on 2026-11-24T04:37:20Z. --- You are right, and thank you for testing the host path: the stand-in took a host's `ShaderCacheControl` as well. Fixed in `6a9edfe37` on this branch. Slot 74 now asks the same caller classifier slot 61 uses (`set_console_caller`): a caller in an image the guest loader mapped gets the stand-in; any other caller, and every caller when no classifier is installed, is forwarded to the PC slot 74, or refused past the PC device's table when the device has no slot 74. The route-override precedence is unchanged (`--env-slots-74` still passes). `xs_proxy_mock_test` has the cases you asked for: the guest case under a classifier, and the host case both with a classifier and with none, on a level-9 device (the call reaches the mock's slot 74 with its words) and on a level-0 one (refused, the mock is not called). It passes under Wine. Checked on the retail boot as well, since the classifier now decides it: the title's call still gets the stand-in (the `slot 74 ... returns S_OK` line appears once, no `ShaderCacheControl` in the trace) and the run reaches the same point as before. #391, #395 and #396 are rebased onto this. AI-assisted.
BadgersMC commented 2026-11-24 12:09:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by BadgersMC on 2026-11-24T12:09:26Z.


Confirmed on native Windows with the same typed ID3D12Device9::ShaderCacheControl(APPLICATION_MANAGED, ENABLE) probe as before. On current head 3ca10dfe (the rebased caller-classification fix is ad9edee6), it returns S_OK and forwards exactly one call with both flags intact. This is the same probe that saw zero forwarded calls on 25826cdd.

All seven xs_proxy_mock* cases pass with MSVC, including xs_proxy_mock_env_slots_74. Windows 11 build 26100, MSVC 19.44, Windows SDK 26100. AI-assisted mock tests, no game files.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7131044127 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/385#issuecomment-7131044127). Originally posted by [BadgersMC](https://github.com/BadgersMC) on 2026-11-24T12:09:26Z. --- Confirmed on native Windows with the same typed `ID3D12Device9::ShaderCacheControl(APPLICATION_MANAGED, ENABLE)` probe as before. On current head `3ca10dfe` (the rebased caller-classification fix is `ad9edee6`), it returns `S_OK` and forwards exactly one call with both flags intact. This is the same probe that saw zero forwarded calls on `25826cdd`. All seven `xs_proxy_mock*` cases pass with MSVC, including `xs_proxy_mock_env_slots_74`. Windows 11 build 26100, MSVC 19.44, Windows SDK 26100. AI-assisted mock tests, no game files.
aslan2142 commented 2026-11-24 23:16:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T23:16:21Z.


Merged. Mumogg is still away and this is the next rung on main's boot path (device slot 74, where the title stops once #383 is in), so I brought the branch up to date the same way as the three rungs before it: one merge commit of main (d9f0a98e1) on top of 3ca10dfe1 (d7e294475). Mumogg's three commits are untouched and nothing was force-pushed.

What it does: device slot 74, called by the title as (pointer, u32, pointer), now returns S_OK instead of reaching the PC ShaderCacheControl, which failed and sent the title to its own int3. A host caller, and every caller when no classifier is installed, still gets ID3D12Device9::ShaderCacheControl. It is a stand-in: nothing is written through the pointers, and the call is logged once with its three words.

Conflicts: three files, and one of them needed more than keeping two additions side by side, so please look at it.

  • runtime/shims/d3d12_xs_device.cpp: this branch moved the Xbox device slot routes into route_xbox_device_slot(), which slot 74's handler asks first. Meanwhile main had added a sixth route to the old inline chain: GetFrameStatisticsX (routes.frame_statistics, slot 81), answered by the presentation handler, or with S_FALSE and a zero count when there is none. I kept the helper and moved that route into it unchanged, between wait_event and queue_x as on main. All six routes were then compared line by line with main's chain: same arguments, same log names, same results, same order.
  • runtime/test/xs_proxy_mock_test.cpp: run_env_slots keeps this branch's on_slot74 parameter next to main's EnvPresenter struct, and main() runs check_slot74() and then check_presentation_wiring().
  • docs/d3d12_vulkan.md: both table rows, in slot order (74, then 81).

Holds and requests: none from a maintainer on this PR. BadgersMC's request (the caller classification from #383, a host passthrough test, and coverage of the override precedence) was answered in ad9edee61, and they confirmed it on Windows with MSVC.

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

  • Full Windows suite under Wine, the branch against main (the tree of #383's merge): nothing changed on either device except the new xs_proxy_mock_env_slots_74, which passes on both (259 pass and 15 fail on llvmpipe, 255 and 21 on the iGPU).
  • xs_proxy_mock and its six variants pass on both. They include main's presenter checks, which now reach GetFrameStatisticsX through the helper, at the default slot and at an overridden one.
  • The 12 test_docs_* files and check_no_game_data.py on the changed files are clean. The Linux portable subset does not build these files.
  • Not run here: MSVC, native Windows, and the game itself. Mumogg's run reports the title going from 1,657 to 11,916 traced calls, ending right after the first call of device slot 108.

Follow-ups, none blocking the boot path:

  • What the console's slot 74 really is, and whether its third pointer is an output the title reads afterwards, is still open. Nobody has looked at what the title does with it after the call.
  • The docs row for slots 48/73/78-80 still says an override onto a handled slot keeps that slot's handler; on 74 the override now wins. An override routed onto 74 also skips note_slot(74).
  • The code comment and the first commit's title cite issue 7231, a number from the original repository that links nowhere now.

#727 (device slots 86, 101 and 108) is the next rung.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147210597 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/385#issuecomment-7147210597). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T23:16:21Z. --- Merged. Mumogg is still away and this is the next rung on `main`'s boot path (device slot 74, where the title stops once #383 is in), so I brought the branch up to date the same way as the three rungs before it: one merge commit of `main` (`d9f0a98e1`) on top of `3ca10dfe1` (`d7e294475`). Mumogg's three commits are untouched and nothing was force-pushed. **What it does:** device slot 74, called by the title as `(pointer, u32, pointer)`, now returns `S_OK` instead of reaching the PC `ShaderCacheControl`, which failed and sent the title to its own `int3`. A host caller, and every caller when no classifier is installed, still gets `ID3D12Device9::ShaderCacheControl`. It is a **stand-in**: nothing is written through the pointers, and the call is logged once with its three words. **Conflicts:** three files, and one of them needed more than keeping two additions side by side, so please look at it. - `runtime/shims/d3d12_xs_device.cpp`: this branch moved the Xbox device slot routes into `route_xbox_device_slot()`, which slot 74's handler asks first. Meanwhile `main` had added a sixth route to the old inline chain: `GetFrameStatisticsX` (`routes.frame_statistics`, slot 81), answered by the presentation handler, or with `S_FALSE` and a zero count when there is none. I kept the helper and **moved that route into it unchanged**, between `wait_event` and `queue_x` as on `main`. All six routes were then compared line by line with `main`'s chain: same arguments, same log names, same results, same order. - `runtime/test/xs_proxy_mock_test.cpp`: `run_env_slots` keeps this branch's `on_slot74` parameter next to `main`'s `EnvPresenter` struct, and `main()` runs `check_slot74()` and then `check_presentation_wiring()`. - `docs/d3d12_vulkan.md`: both table rows, in slot order (74, then 81). **Holds and requests:** none from a maintainer on this PR. BadgersMC's request (the caller classification from #383, a host passthrough test, and coverage of the override precedence) was answered in `ad9edee61`, and they confirmed it on Windows with MSVC. **Tests** (clang-cl with the xwin SDK; Wine, headless; llvmpipe and an RDNA2 iGPU): - Full Windows suite under Wine, the branch against `main` (the tree of #383's merge): nothing changed on either device except the new `xs_proxy_mock_env_slots_74`, which passes on both (259 pass and 15 fail on llvmpipe, 255 and 21 on the iGPU). - `xs_proxy_mock` and its six variants pass on both. They include `main`'s presenter checks, which now reach `GetFrameStatisticsX` through the helper, at the default slot and at an overridden one. - The 12 `test_docs_*` files and `check_no_game_data.py` on the changed files are clean. The Linux portable subset does not build these files. - Not run here: MSVC, native Windows, and the game itself. Mumogg's run reports the title going from 1,657 to 11,916 traced calls, ending right after the first call of device slot 108. **Follow-ups, none blocking the boot path:** - What the console's slot 74 really is, and whether its third pointer is an output the title reads afterwards, is still open. Nobody has looked at what the title does with it after the call. - The docs row for slots 48/73/78-80 still says an override onto a handled slot keeps that slot's handler; on 74 the override now wins. An override routed onto 74 also skips `note_slot(74)`. - The code comment and the first commit's title cite issue 7231, a number from the original repository that links nowhere now. #727 (device slots 86, 101 and 108) is the next rung. AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!385
No description provided.