[PR #1390] d3d12_xs: the first call of a forwarded device slot names its caller (OLD-9990, RT-526) #1420

Open
opened 2026-11-26 20:21:12 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1390
Author: @Diegobecker07
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: old-9990-slot-caller


📝 Commits (2)

  • f1119e2 d3d12_xs: the first call of a forwarded device slot names its caller (RT-526)
  • 94ba783 d3d12_xs: slot caller via a formatter hook, cleared on reset (review of #9990)

📊 Changes

4 files changed (+52 additions, -3 deletions)

View changed files

📝 runtime/shims/d3d12_xs_device.cpp (+32 -3)
📝 runtime/shims/d3d12_xs_device.h (+10 -0)
📝 runtime/src/main.cpp (+2 -0)
📝 runtime/test/xs_proxy_mock_test.cpp (+8 -0)

📄 Description

Claimed in the coordination issue as: OLD-9990 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146930294)

Carries over #260 (old upstream PR 9990 by Amzi-01; the two commits are kept with their author), rebased on current main. #260 can be closed in favour of this once it is reviewed.

What and why

RT-526's caller half. The first call of each device slot that the proxy's generic thunk takes by number now names its caller:

[rt] d3d12_xs: device slot 78 (Xbox SetFrameIntervalX) first call from game_scarlett_master.exe+0x…

Without this, finding the call site of a new Xbox-only slot took a debugger. The caller is _ReturnAddress() in the thunk. It is printed through a formatter hook that gta6rt points at rt::shims::module_offset, so d3d12_xs_device.cpp does not depend on the module table and test targets link it alone; with no formatter it is the bare address in hex. reset_device_proxy_stats clears it with the first-call flag.

Rebase on main: two conflicts, both in runtime/shims/d3d12_xs_device.cpp, both resolved by keeping main's side and adding this PR's:

  • the includes: main's d3d12_xs_alloc_size.h / d3d12_xs_desc_clean.h stay. The first commit's shims.h is dropped again by the second, as in #260.
  • the generic thunk: main's slot 26 console form stays before note_slot, which now takes the caller.

#228 overlap: #228 (old PR 9961, RT-526) has its own version of this logging (set_caller_describer). Its other half, LEONIDA_SKIP_ASSERTS, is carried over separately (OLD-9961) without that logging, so the two do not collide.

Tested

  • scripts\build_runtime.ps1 (MSVC 19.44, VS 2022 Build Tools, CMake 3.31.6 + Ninja, Vulkan SDK 1.4.363.0): builds.
  • ctest -R "xs_proxy_mock|device_proxy|d3d12_xs|pe_loader|run_tiny_game": 22/22 passed. xs_proxy_mock includes #260's check: slot 78's first caller recorded in hex without a formatter, forgotten on reset, recorded again.
  • Retail boot (own 1.0.2.1 copy, LEONIDA_D3D12=vulkan, --trace, --trace-d3d12, overlay outside the package): six slots name their callers as module+offset, five in the executable and one in XboxBvhBuilder.dll (slot 16, CreateRootSignature). The run otherwise ends as on main (the same 1,639 D3D12 calls, then the title's fail-fast about 27 s later). No address from the executable is quoted here.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Vulkan 1.4.357, Windows 11 Pro 26300

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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: no translator change)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1390 **Author:** [@Diegobecker07](https://github.com/Diegobecker07) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-9990-slot-caller` --- ### 📝 Commits (2) - [`f1119e2`](https://github.com/ubiquitarianism/leonida/commit/f1119e2906dcd166ecc5afea05bab8e9616dbeca) d3d12_xs: the first call of a forwarded device slot names its caller (RT-526) - [`94ba783`](https://github.com/ubiquitarianism/leonida/commit/94ba78348ee98b2ae7271eeb218d2f4befc2a714) d3d12_xs: slot caller via a formatter hook, cleared on reset (review of #9990) ### 📊 Changes **4 files changed** (+52 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_device.cpp` (+32 -3) 📝 `runtime/shims/d3d12_xs_device.h` (+10 -0) 📝 `runtime/src/main.cpp` (+2 -0) 📝 `runtime/test/xs_proxy_mock_test.cpp` (+8 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9990 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146930294) Carries over #260 (old upstream PR 9990 by Amzi-01; the two commits are kept with their author), rebased on current `main`. #260 can be closed in favour of this once it is reviewed. ### What and why RT-526's caller half. The first call of each device slot that the proxy's generic thunk takes by number now names its caller: `[rt] d3d12_xs: device slot 78 (Xbox SetFrameIntervalX) first call from game_scarlett_master.exe+0x…` Without this, finding the call site of a new Xbox-only slot took a debugger. The caller is `_ReturnAddress()` in the thunk. It is printed through a formatter hook that gta6rt points at `rt::shims::module_offset`, so `d3d12_xs_device.cpp` does not depend on the module table and test targets link it alone; with no formatter it is the bare address in hex. `reset_device_proxy_stats` clears it with the first-call flag. **Rebase on `main`:** two conflicts, both in `runtime/shims/d3d12_xs_device.cpp`, both resolved by keeping `main`'s side and adding this PR's: - the includes: `main`'s `d3d12_xs_alloc_size.h` / `d3d12_xs_desc_clean.h` stay. The first commit's `shims.h` is dropped again by the second, as in #260. - the generic thunk: `main`'s slot 26 console form stays before `note_slot`, which now takes the caller. **#228 overlap:** #228 (old PR 9961, RT-526) has its own version of this logging (`set_caller_describer`). Its other half, `LEONIDA_SKIP_ASSERTS`, is carried over separately (OLD-9961) without that logging, so the two do not collide. ### Tested - `scripts\build_runtime.ps1` (MSVC 19.44, VS 2022 Build Tools, CMake 3.31.6 + Ninja, Vulkan SDK 1.4.363.0): builds. - `ctest -R "xs_proxy_mock|device_proxy|d3d12_xs|pe_loader|run_tiny_game"`: 22/22 passed. `xs_proxy_mock` includes #260's check: slot 78's first caller recorded in hex without a formatter, forgotten on reset, recorded again. - Retail boot (own 1.0.2.1 copy, `LEONIDA_D3D12=vulkan`, `--trace`, `--trace-d3d12`, overlay outside the package): six slots name their callers as `module+offset`, five in the executable and one in `XboxBvhBuilder.dll` (slot 16, `CreateRootSignature`). The run otherwise ends as on `main` (the same 1,639 D3D12 calls, then the title's fail-fast about 27 s later). No address from the executable is quoted here. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Vulkan 1.4.357, Windows 11 Pro 26300 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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: no translator change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1420
No description provided.