Device-method slot interface names + exit-time call summary (on top of #376) #495

Open
ZaneIceMaster11 wants to merge 2 commits from upstream-pr/495 into main
ZaneIceMaster11 commented 2026-11-25 01:35:38 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ZaneIceMaster11 on 2026-11-25T01:35:38Z.


Depends on #376 (VICTORY_SHADER_DIAG) - this diff includes that PR's changes too since GitHub won't let a PR target a branch that only exists on the fork. Once #376 merges this will shrink to just device.rs/lifecycle.rs.

What this adds

Addresses a review comment on #376: when a slot number is in the detail field, name the resolved D3D12 interface too, and add a per-slot total at process exit next to the running per-call counter.

Interface resolution

Computed exact PC vtable slot boundaries for IUnknown through ID3D12Device4 directly from the pinned windows 0.62.2 crate source (counting each ID3D12DeviceN_Vtbl's fields, accounting for how windows-rs keeps feature-gated fields at a fixed slot with a dummy type rather than removing them - confirmed this by reading the actual generated vtable structs, not assuming). Deliberately hedged past ID3D12Device4 (slot 56): this module's own doc comment already says the title's vtable only matches PC order until "console additions follow", and I found that boundary is demonstrably at or before Device5 - the file's existing hand-written comment claims Device5/Device8 each add 9 methods, but the pinned crate has 8 and 5. Both slots this project actually hits (0x1c8, 0x218) are past that boundary, so they now report "ID3D12Device5-or-later, console layout may diverge from PC here" rather than a wrong confident name - a bad guess here would be worse than the honest uncertainty.

Exit summary

unknown_pipeline's per-monomorphization static CALLS: [AtomicU32; 2] (a separate array per const-generic SLOT, despite looking shared) became one module-level Mutex<BTreeMap<usize, u32>> both instantiations write into, so report_unimplemented_calls() can summarize every slot at once. Called from lifecycle::end() next to the existing pipeline-cache save, since the process terminates via TerminateProcess there (no atexit/normal shutdown runs).

Verification

Real run (Series X, opening cutscene, no crash): exit summary printed exactly as designed, matching the live per-call counters seen during the run (slot=0x1c8 calls=25450, slot=0x218 calls=2689). Build, clippy (-p victory-gpu -p victory-hle --all-targets --release --features diagnostics), and tests (213, both crates) all clean.

Co-authored with Claude Code (Claude Sonnet 5).

<!-- greyfinch-sync:fxceless/victory-fork:issue:6595102524 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/495). Originally posted by [ZaneIceMaster11](https://github.com/ZaneIceMaster11) on 2026-11-25T01:35:38Z. --- **Depends on #376 (VICTORY_SHADER_DIAG)** - this diff includes that PR's changes too since GitHub won't let a PR target a branch that only exists on the fork. Once #376 merges this will shrink to just `device.rs`/`lifecycle.rs`. ## What this adds Addresses a review comment on #376: when a slot number is in the detail field, name the resolved D3D12 interface too, and add a per-slot total at process exit next to the running per-call counter. ### Interface resolution Computed exact PC vtable slot boundaries for IUnknown through ID3D12Device4 directly from the pinned `windows` 0.62.2 crate source (counting each `ID3D12DeviceN_Vtbl`'s fields, accounting for how windows-rs keeps feature-gated fields at a fixed slot with a dummy type rather than removing them - confirmed this by reading the actual generated vtable structs, not assuming). Deliberately hedged past `ID3D12Device4` (slot 56): this module's own doc comment already says the title's vtable only matches PC order until "console additions follow", and I found that boundary is demonstrably at or before Device5 - the file's existing hand-written comment claims Device5/Device8 each add 9 methods, but the pinned crate has 8 and 5. Both slots this project actually hits (`0x1c8`, `0x218`) are past that boundary, so they now report `"ID3D12Device5-or-later, console layout may diverge from PC here"` rather than a wrong confident name - a bad guess here would be worse than the honest uncertainty. ### Exit summary `unknown_pipeline`'s per-monomorphization `static CALLS: [AtomicU32; 2]` (a separate array per const-generic `SLOT`, despite looking shared) became one module-level `Mutex<BTreeMap<usize, u32>>` both instantiations write into, so `report_unimplemented_calls()` can summarize every slot at once. Called from `lifecycle::end()` next to the existing pipeline-cache save, since the process terminates via `TerminateProcess` there (no `atexit`/normal shutdown runs). ## Verification Real run (Series X, opening cutscene, no crash): exit summary printed exactly as designed, matching the live per-call counters seen during the run (`slot=0x1c8 calls=25450`, `slot=0x218 calls=2689`). Build, clippy (`-p victory-gpu -p victory-hle --all-targets --release --features diagnostics`), and tests (213, both crates) all clean. Co-authored with Claude Code (Claude Sonnet 5).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/495:upstream-pr/495'
git switch 'upstream-pr/495'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/495'
git switch 'upstream-pr/495'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/495'
git switch 'upstream-pr/495'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/495'
git switch 'main'
git merge --squash 'upstream-pr/495'
git switch 'main'
git merge --ff-only 'upstream-pr/495'
git switch 'main'
git merge 'upstream-pr/495'
git push origin 'main'
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
fxceless/victory-fork!495
No description provided.