gpu(replay): support in-place vtable hooks for Wine/vkd3d-proton recording #113
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!113
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/113/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Androtim on GitHub · 2026-11-29 11:45 UTC · original
Androtim:feat/iter114-replay-inplace-wine-hooks→main· +237 −6 · 2 files · 1 commits · merged 2026-11-29 14:32 UTCSummary
crates/victory-gpu/src/replay/hook.rs(active automatically under Wine viantdll!wine_get_versionunlessVICTORY_RECORD_HOOK=copy, or opt-in on native Windows viaVICTORY_RECORD_HOOK=inplace) sovkd3d-protonobjects retain their original vtable identity pointers duringVICTORY_RECORDcaptures.state_oflookup and guardexecute()/of()incrates/victory-gpu/src/replay/record.rsso unrecorded COM objects sharing the patched class vtable pass cleanly through to the original method.in_place_the_class_table_changes_and_the_old_methods_stay_callable.cool_foxcommitdf0b5e40(GPL-3.0).Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy->asset policy: 303 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --features diagnostics --locked -- replay::->test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 581 filtered out; finished in 0.24scargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings->0 warningscargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings->0 warnings@Androtim on GitHub · 2026-11-29 12:05 UTC · original
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
PR #113 adds an in-place COM vtable hooking mode (
inplace()) tocrates/victory-gpu/src/replay/hook.rsand guards unrecorded-object state lookups incrates/victory-gpu/src/replay/record.rs(execute,of), enablingVICTORY_RECORDcaptures under Wine/vkd3d-protonwhere replacing an object's vtable pointer breaksvkd3d-proton's vtable-identity checks.What looks good
inplace()only activates automatically whenntdll!wine_get_versionis present (overridable viaVICTORY_RECORD_HOOK=copy|inplace), leaving native Windows copy-shim behavior unchanged by default.install_inplace()snapshots readable slots into a leaked copy inCLASSESand populatesNOTED_ORIGbefore callingwrite_table()(VirtualProtect+write_volatile), so concurrent calls through the patched vtable see validorig()andnoted_inplace::<AT>()targets.noted_inplacepreserves all Windows x64 ABI argument registers and tail-jumps cleanly.state_of()returnsNonefor objects sharing a patched class vtable that were not passed toinstall(), andexecute()/of()inrecord.rspass those calls straight through to the original method.in_place_the_class_table_changes_and_the_old_methods_stay_callablecovers in-place patching,orig(),noted_inplacecounting/forwarding, andours()/state_of()isolation.Non-blocking edge-case notes
hook::again()(inplace()branch), if an unrecorded object (absent fromSTATES) swaps its vtable pointer (e.g., vialist_reset),install_inplace(this, null, patch)inserts(this, 0)intoSTATES.state_of()still returnsNone(becauseat != 0), butours(this)becomestrueand a subsequentinstall()on that address would returnfalse.NOTED_ORIGis indexed byclass * SLOTS + slot; if two distinct vtables of the same class (e.g., open vs. closed command-list vtables on native D3D12 withVICTORY_RECORD_HOOK=inplace) have different original targets for the same unrecorded slot, the second table's patch overwritesNOTED_ORIGfor the first.STATESis keyed by raw COM pointer and never pruned onRelease, so pointer reuse after object destruction ininplacemode would retain stale state.Verdict
needs-gpu-test— logic, security, and CI look solid, and the D3D12 COM vtable patching (VirtualProtecton runtime.rdatavtables +VICTORY_RECORDcapture underVICTORY_RECORD_HOOK=inplace/ Wine) warrants a local real-GPU smoke test before merging.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 12:44 UTC · original
Ran a live RTX 4060 Ti (Series S)
--features diagnosticssmoke test forcingVICTORY_RECORD_HOOK=inplace(VICTORY_RECORD+VICTORY_RECORD_AT=60+VICTORY_RECORD_FRAMES=1) to verify runtime COM vtableVirtualProtectpatching,noted_inplacethunk forwarding, and unrecorded-object pass-through on real D3D12 hardware:max_draws=12406,7755+presents) with 0 crashes, 0 panics, and 0 DRED/host-texture errors.victory_gpu::replay::recordactivated (frame recorder on),victory_gpu::replay::snaparmed list recording atpresents=7711and started frame capture atpresents=7755, writingshaders.bin(115.6 MB) andcontents.bin(2061.8 MB) without faulting or breaking unrecorded COM calls.8/8captured frames lit (luma=105.47,near_black=0.0%,edge_energy=14.99,magenta=0.0%); visually inspectedframe-7745.pngandframe-7753.png.deltas.bin/present.bin0 bytes), and FPS/queue deltas (3.3 fpsacross 2 windows,24421waiting) reflect--features diagnosticsoverhead + writing a2.08 GBframe snapshot during the window rather than runtime regression.Note: Wine/
vkd3d-protonauto-detection (ntdll!wine_get_version) remains unit-tested (replay::hook— 29 replay tests passing) and was not exercised on Linux/Wine in this Windows run.@Androtim on GitHub · 2026-11-29 14:32 UTC · original
Automated RTX 4060 Ti 8 GB Wave 3 A/B hardware verification passed (
playtest/wave3vsorigin/mainc7ed150— 5/5 A/B gates PASS):cargo test(RTX 4060 Ti):victory-gpu542 passed, 0 failed (36 ignored);victory-shader323 passed, 0 Wave 3 regressions (the 3 PSV0 validation failures inemit::rect::testsandemit::barycentric_testsalso fail identically onorigin/mainc7ed150).scripts/verify-world.ps1, DLSS Quality + golden autosave):10.25 fpsvs10.7 fpsbaseline (min FPS improved6.9vs4.2, preparing45.35 msvs50.3 ms)5948 MBvs6073 MB(-125 MB,0 MBover budget)final_waiting=5487vs7350(-1863);no room for new ones38vs43mapped_rate=20.95 ms/svs37.22 ms/s(-44%)frame-10645.png,frame-10669.png), luma82.77vs23.2, edge energy2.27vs1.81, magenta0.0%.