D3D12.X: keep vkd3d-proton's vtables under Wine and wrap the title's fences (#175) #3492
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3492"
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?
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-30T02:45:57Z.
Edited 2026-12-02: head
d9afcbf1after bmjask's reviews (see Tested).Under Wine, vkd3d-proton takes an object only with its own vtable, and XCL replaces the vtable of every object it adopts. This carries #867 and #2477 by gustavsi (both closed unmerged on 2026-11-29: "anyone is welcome to rebase and reuse these commits") onto the current
main, as one commit with gustavsi as co-author. Part of #175 and #3067.#3099 does the fence and guard part against
amd-dev; this one is againstmainand also has #2477's in-place tables.What is in it
real.rs: under Wine, heaps, resources, descriptor and query heaps, root signatures, pipeline states and command signatures keep the runtime's table, with XCL's PC slots written into it (#2477).UnadoptGuardgives a list, allocator, heap or pipeline its native table back for the host call that takes it as an argument, and the title's fences are proxies unwrapped at the queue'sSignalandWait(#867).real.rs,list_x.rs,sparse.rs,alloc_pool.rs,vram.rs,present.rs,title_textures.rs,late_release.rs,cpu_writes.rs,bind.rs: the submit, reset and fence sitesmainhas gained since those PRs (native_queue_execute, the sparse queues, the two-pass feedback poll, the own-work submit, the retire and upload fences) get the same guard orcreate_raw_fence.main(gpu_clear_uav_of_a_stencil_uav_clears_the_twin) signalled a device fence on a PC queue; it takes a raw fence.Tested
master71cae091(assertions on), RTX 4060 Ti 16 GB (driver 615.71.09), rustc 1.98.0, release build forx86_64-pc-windows-gnu. Base9335bc0d, head3bd9a664.d9afcbf1(2026-12-02), after bmjask's three reviews and Foniass's, rebased ontomain078358a0: bothExecuteBundleentries (the PC one and the console slot 27 inlist_x) give the bundle its native table (vkd3d-proton dropped an adopted bundle);create_raw_fenceputs its fences inFENCES, asmain'sCreateFencedoes, soend_titlesignals them (the separate call for thelist_xcell fences is gone); the fence proxy's table is as long as an adopted fence's; the two-pass feedback submit is guarded on a queue XCL did not adopt too, and its fence is a raw one.cargo test --lib --release -- fence vtable wine unadopt two_pass bundleunder Wine on the CPU only (lavapipe, no card): 100 passed, 0 failed. Three new tests, each failing without its change (none for the feedback guard, which needs a device).d9afcbf1:cargo test --workspace -- --test-threads=4, 3,018 passed, 0 failed, 52 ignored, 1 run; 30SKIPPEDlines (wave64 tests: no wave64 on this card; no D3D12 debug layer; noGPU_UPLOADheaps; heap windows off; the driver cache cannot be turned off without Developer Mode;a_raw_fence_made_under_wine_is_signalled_at_the_title_end: not under Wine).0797336e(2026-12-01): under Wine the device'sCreateSharedHandleandSetEventOnMultipleFenceCompletionhand vkd3d-proton its own fence too (one new test, with stand-in objects; not on a device or in a title).cargo test --lib -- fence vtable wine unadopt, RTX 4060 Ti: 57 passed, 0 failed in 5 of 6 runs; in the first,bind::tests::wait_oldest_fenced_reclaims_in_flight_buffer_before_refusingfailed once while a title was running on the same card (it passes alone, 3 of 3).76427620(2026-12-01), after a second review:UnadoptGuard::newand the tests now run the same body, so the Windows CI runs the shipped guard (the Wine-only guard test became a case of one that runs everywhere); the list of native tables warns once past its 64 entries, where it dropped a table silently.cargo test --lib -- fence vtable wine unadopt, RTX 4060 Ti: 56 passed, 0 failed. 997 added lines.313f55e8(2026-12-01), after a review: the fence proxy's GetCompletedValue, SetEventOnCompletion and Signal are nowmain's hooks, run on vkd3d-proton's own fence (they went straight to vkd3d-proton before, so a title's fence skipped the readback settlingmaingained on 2026-11-25); fences XCL makes inside its own work are not wrapped; the queue's Signal / Wait overrides are underunder_wine()again, so Windows takesmain's path; three new tests.cargo test --lib -- fence vtable wine unadopt: 57 passed, 0 failed.--lib hle::d3d12x::real::: 178 passed, 3 failed (an_older_process_cannot_remove_a_replacement_blob,a_copy_of_a_destroyed_resources_view_is_the_null_view,dev_create_root_signature_strips_xbox_flags_and_keeps_parameters; all three fail the same way on the head before it). 1,042 added lines now. In a title, the change of this head on another tree that carries this pull request beside other unmerged ones (1 run each, 600 s asked, RTX 4060 Ti,XCL_GPU_PROFILE=1): with it 630 s, 1,880 frames, no crash, no device removal; without it 673 s, 1,520 frames, no crash. Not run in a title on this branch alone: the title numbers below are from the heads they name.main7d86c5d2(headebc21f2e):main'sCreateFencenow drops console-only flag bits; the Wine path here passes the same cleaned flags.cargo test --lib -- fence vtable wine: 54 passed, 0 failed. The numbers below are from the heads they name.0f347f68(2026-11-30): the cause of the rare trap with 4 test threads. Under vkd3d-proton every test gets the same device object, and some tests adopt it. A test that then makes a fence or a list from it gets XCL's proxy or an adopted list, and its own PC queue cannot take either.bind::tests::closed_list_replay_keeps_two_pass_buffer_across_fence_and_idle_trimbesidecreate_list_reset_and_clear_state_track_initial_pso_on_d3d12ended that way 10 of 12 times; with a raw fence and the guard at its two submits, 0 of 20, andhle::d3d12x::bind::testsat 4 threads ran through 10 of 10 (4 of 16 ended early before).c817f425(2026-11-30):bind::tests::execute_indirect_reads_the_arguments_written_before_it, a test new onmainthat adopts its list and submits it on a PC queue, takes the guard at that submit. It ended in the read at0x2b28on19e8fd50(found on an RX 9070 by ClosetPie107, below; the same here) and passes now.mainf97120dc(head19e8fd50):main's rewritten late-release seal and itsInListResetincl_resetconflicted; both keep the raw fence and the guards. On the new head the release build and these modules were rerun, with the same results as before:late_release8 passed,real::wine_vtable_tests4,real::in_place_tests2,real::depth_uav_twin_tests3,title_textures65,sparse::tests140,list_x::tests101 passed and 3 failed (the three that fail on the base). The counts and title runs below are on3bd9a664.hle::d3d12xunit tests, each test module in a process of its own with--test-threads=4(96 modules, 1 pass of each tree; a whole-suite run ends early in a page fault on both trees):9335bc0d3bd9a664list_x::tests,tests)tests)The base's
list_x::testsends after 5 tests in vkd3d-proton's list check (a read at0x2b28); with this PR it runs through.hle::d3d12x::testsends the same way on both, a null read after aD3D12SerializeRootSignaturecall with an invalid version. Of this PR's 17 failures, 15 fail on the base too; the other two are inlist_x::tests, which the base does not get to in this pass, and both failed on the base in an earlier whole-suite run.game+0x2478b7bwithE_INVALIDARGinrax(the failure #3099 describes); on this head it presented until the run's 300 s limit ended it (1,430 frames by then, lit, the last ones the loading pictures), with no crash and no device removal.master71cae091, debug build): the lib suite at 2 threads withoutgpu::and six tests that end the process or run out of memory there, 1,715 passed and 16 failed at0f347f68against 1,609 and 116 on the basef97120dc; no test fails with this PR that passes on the base.Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by
scripts/smoke.ps1, the same retail title for 60 s each.main:this PR's head:
Not tested
under_wine().gpu::tests and a title run.hle::d3d12x::sparse::testsin 20 did on the first head). It is between tests: the title's device is always adopted, and its queues with it.AI use
main, ran the tests above and wrote this description. The merge resolutions it starts from were made on our Linux branch with Claude Opus 5.5. Claude Opus 5.5 made the changes after bmjask's reviews of 2026-12-02 and their tests.Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T12:53:06Z.
Test report for #3492 at
19e8fd50, against its basemainf97120dc, under Wine. It wasn't run on Windows.Tested
experimental-11.0-20261112, stock vkd3d-protonmaster71cae091. Debug build,x86_64-pc-windows-gnu.cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>, always with--skip gpu:: --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the last two run out of memory here).f97120dc19e8fd50hle::d3d12x::at 2 threads-14CS rejection afterlist_x::…write_buffer_immediate_on_open_existing_heap_visible_to_cpu(the leak #1520 fixes; #3492 doesn't include it)-14atreal::readback_routing_tests::coherent_buffer_sanitizes_console_flags_and_statebind::…create_list_reset_and_clear_state_track_initial_pso_on_d3d12aloneCreateCommandListrefuses the list)title_textures::…a_placed_texture_gets_the_pages_of_a_level_with_its_texelsalonebind::…execute_indirect_reads_the_arguments_written_before_italoned3d12core.dll+0x56215d, read of0x2b28main's failures under Wine are gone with #3492 (98 → 10 inhle::d3d12xbefore the run ends). The cascade of refused list creations doesn't happen.hle::d3d12x::sparse::testsat 4 threads, 20 runs: no trap in vkd3d-proton's list check.a_tile_of_a_gpu_view_shows_the_page_mapped_therefailed 4 of 20 (!v.s.mapped.contains_key(&(w + TILE)),sparse.rs:12315). Alone it passed 20 of 20.hle::d3d12x::tests::serialize_root_signature_strips_console_flags_and_preserves_pc_flagscrashes the process alone onf97120dcas well.-14at the coherent test: that testVirtualFrees memory whilelate_releasestill holds the resource. Under Wine that succeeds, and RADV rejects the next submission (#3067). That isn't from this PR either.Not tested
gpu::testsAI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-30T12:59:27Z.
@ClosetPie107 thank you, that is the run this needed.
bind::tests::execute_indirect_reads_the_arguments_written_before_itcrashes the same way here on NVIDIA at19e8fd50. It is the test's own submit: it adopts its list (to record as XCL does) and then callsExecuteCommandListson a plain PC queue.c817f425puts the guard around that submit, as #867 did for the older tests of that shape; it passes here now (RTX 4060 Ti, stock vkd3d-protonmaster71cae091, 1 run alone).One thing is still open and you may see it too: with 4 test threads, 1 of 4 runs of
hle::d3d12x::bind::testsatc817f425ended in the read at0x2b28(the other 3: 115 passed, 1 failed;maind52ff48c: 106 passed, 10 failed, 4 of 4). With one thread I have not seen it. The description says so under Not tested.Your
sparse::tests::a_tile_of_a_gpu_view_shows_the_page_mapped_therefailure at 4 threads (4 of 20, never alone) I have not looked at yet.AI use: Claude Code (Claude Fable 5.2) made the runs and wrote this.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-30T16:03:04Z.
Test report for #3492 at
0f347f685f059f26749e8113f7ae8ff57af43bef, against its merge-base withmain,f97120dc, under Wine on AMD.Tested
experimental-11.0-20261112, stock vkd3d-protonmaster71cae091. Debug build,x86_64-pc-windows-gnu, under Wine. It wasn't run on Windows.cargo test --locked -p xcl --lib --target x86_64-pc-windows-gnu -- <filter>.--test-threads=1 <name>): all 6 pass:a_vtable_patched_in_place_keeps_its_originals_and_its_neighbour,concurrent_calls_and_patches_on_readonly_vtable_never_tear_or_miss_orig_fn,concurrent_release_during_unadopt_guard_still_runs_hooked_cleanup,fence_proxy_forwards_signal_unwraps_and_frees_on_final_release,track_end_title_fence_registers_once_and_addrefs,unadopt_guard_restores_native_vtable_and_reapplies_extended_on_drop. 6 passed, 0 failed.--test-threads=2, with--skip gpu::and these six:failed_restore_stops_before_importing_an_unbacked_window,grooming_leaves_a_window_under_1_gib_only_its_hole(both run out of memory here),write_buffer_immediate_on_open_existing_heap_visible_to_cpu,coherent_buffer_sanitizes_console_flags_and_state,serialize_root_signature_strips_console_flags_and_preserves_pc_flagsandexecute_indirect_reads_the_arguments_written_before_it. Under Wine each of the last four ends the process or makes RADV reject later submissions (#3067), so without them the suite reaches its summary:0f347f68: 1715 passed, 16 failed, 5 ignoredf97120dc: 1609 passed, 116 failed, 5 ignoredmain's known ones on stock vkd3d-proton: list creation refused (E_INVALIDARG, #175 / #1701) and the tests after it (#3067).19e8fd50,bind::tests::execute_indirect_reads_the_arguments_written_before_itpasses alone (3 of 3). At19e8fd50it crashed (access violation atd3d12core.dll+0x56215d).title_textures::…a_placed_texture_gets_the_pages_of_a_level_with_its_texelsandbind::…create_list_reset_and_clear_state_track_initial_pso_on_d3d12pass alone too.hle::d3d12x::sparse::testsat 4 threads, 10 runs: no trap in vkd3d-proton's list check.a_tile_of_a_gpu_view_shows_the_page_mapped_therefailed 1 of 10 (!v.s.mapped.contains_key(&(w + TILE)),sparse.rs:12315), as at the old head (4 of 20); it passed 20 of 20 alone there.Not tested
gpu::tests in the suite runs-p xcl --lib)AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:12:32Z.
Review (head
ebc21f2e, diff read, not a merge-check:PR descriptionfails (no smoke blocks, no Windows suite run), so not built or run here):real.rs~5147-5157), so title fences skip main'sfence_get_completed_value(settle_readbacks_try,title_textures::safe_fence_value),fence_set_event_on_completion(async sparse readbacks) and thesend_pendingstep infence_signal(~4358-4362, ~12359-12440). A title could see a fence complete before its texture downloads or sparse readbacks have landed and read stale memory.under_wine(), so XCL's own Signal / Wait on adopted queues take the CLASSES lock throughslot_ofon every call (same result, extra lock).UnadoptGuard::new(~1461) callsreadable()and takes the globalUNADOPTEDlock beforeskips_guard, on everybind_pipeline_exact, reset and execute; checkingskips_guardfirst would avoid that.under_wine()(any Wine), not vkd3d-proton specifically. Patching vkd3d-proton's vtables in place makes XCL's Release hooks run for every object of those classes, including XCL's own resources that main deliberately leaves unadopted; please say whether that's intended.create_raw_fenceswaps across 9 files and the test-site guards could go first as a preparation PR.Fine: in-place patching happens once per table under a lock and keeps the original entries, the guard pins a reference and does the final release through XCL's Release hook, and the proxy frees itself on the last release.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T08:49:14Z.
Thanks. Point by point, at head
313f55e8:main's hooks gained the readback settling. Its GetCompletedValue, SetEventOnCompletion and Signal are nowmain's hooks, run on vkd3d-proton's own fence; XCL's own fence queries unwrap the proxy first and skip the hook, as onmain. Fences made inside XCL's own work are no longer wrapped.under_wine()again, so Windows takesmain's path; under Wine they no longer take the class lock.UnadoptGuard::new: not as proposed: checkingskips_guardfirst would skip an object whose native table another thread's guard has put in, and that guard's drop would then restore XCL's table in the middle of this call. A lock-free pre-check that is equivalent was added instead.create_raw_fencewith their call sites first, about 500 lines; then the tables, the proxy and the queue unwrap), but the first part alone still stops at vkd3d-proton's assertion. I can split it if that is wanted.cargo test --lib -- fence vtable wine unadopt, RTX 4060 Ti under Wine: 57 passed, 0 failed. Not run in a title on this head yet; the Windows suite and the smoke pair are still owed.AI use: Claude Code. Claude Opus 5.5 checked the points and wrote the changes; Claude Fable 5.2 ran the tests on the card and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:01:50Z.
Review (head
313f55e8, diff read, not a merge-check;PR descriptionred, no Windows run):under_wine(), which looks forntdll!wine_get_versionand caches the answer. Title fences aren't wrapped on Windows. The queue's Signal / Wait overrides are Wine-only. With in-place tables off, the table sizes inmake_classmatch main. What Windows still pays is oneOnceLockload perorig_fncall, perUnadoptGuard::newand perunwrap_fence. That includes every pipeline bind (bind_pipeline_exact) and everyExecuteCommandLists. It's small, but the suite and the smoke pair on Windows are what would show it, and neither has run (the description says so).create_raw_fenceat the ~15 call sites (same behaviour on Windows);class_for/patch_in_place);UnadoptGuard;UnadoptGuard::enter(real.rs~1492) that copiesnew's body.a_guard_on_an_object_...(~15668) returns early off Wine. The Wine branches ofclass_for(~1604) anddev_create_fence(~5282) aren't covered.is_adoptedbecomes true for them.uma_driver.rs(~529, ~627) still callsdev.CreateFenceand may hand a proxy to vkd3d-proton.IN_PLACE_MAX32, the 64-entry fast tables) fail silently when exceeded.amd-dev. One should be picked. This carries over #867 and #2477, which were closed unmerged.Fine:
track_end_title_fence(real.rs~5248) is a no-op on Windows, becausedev_create_fencealready tracked the fence. The proxy shares the real fence's reference count and is freed with it.patch_in_placesaves the entries under a lock before writing.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T09:48:36Z.
Thanks. On the Wine-only list and the tests, at head
76427620:uma_driver.rsfences: not so. Those calls run inopen_uma, before the device is adopted, so the fence is vkd3d-proton's own. Every other remainingCreateFencereaches the runtime only through a Signal / Wait that unwraps the proxy.is_adopted: both true, and neither gives a wrong result: under Wine only lists and allocators get guards, the title may not call one while it is an argument, and Release is pinned;is_adoptedonly picksorig_fn, which for an in-place table is the runtime's own entry.UnadoptGuard::newand the tests now run the same body, so the Windows CI runs the shipped guard, and the Wine-only test became a case of one that runs everywhere. The Wine branches ofclass_foranddev_create_fencestay uncovered off Wine.OnceLockloads a call, no allocation, and one lock write per new sync-graph cell fence. The suite and the smoke pair on Windows are still owed.SetEventOnMultipleFenceCompletionwith two or more fences, orCreateSharedHandleon a fence, would still hand vkd3d-proton the proxy. Not hooked yet; now in the description.On the split and #3099: the four parts build in the order you give, and under Wine nothing improves before the last. #3099 is the same guard and proxy in an older form against
amd-dev, without the in-place tables. I will leave which of the two goes forward, and whether to stack this one, to the maintainers and the author of #3099.cargo test --lib -- fence vtable wine unadopt, RTX 4060 Ti under Wine: 56 passed, 0 failed.AI use: Claude Code. Claude Opus 5.5 checked the points and wrote the changes; Claude Fable 5.2 ran the tests on the card and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:55:39Z.
Re-review (head
76427620; the diff from313f55e8, which I reviewed, read:real.rs+18 / -63). Not a merge-check:PR descriptionis still red.UnadoptGuard::newand the tests share one body, so Windows CI runs the guard that ships. The Wine-only guard test became a case of a test that runs everywhere.create_raw_fencesites / in-place tables /UnadoptGuard/ the fence proxy);amd-dev.SetEventOnMultipleFenceCompletionwith two or more fences, orCreateSharedHandleon a fence, would hand vkd3d-proton the proxy.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T10:10:39Z.
The gap is closed at head
0797336e: under Wine the device'sCreateSharedHandleandSetEventOnMultipleFenceCompletionnow unwrap the proxy and hand vkd3d-proton its own fence (one new test, red without either unwrap; tested with stand-in objects, not on a device or in a title). The other paths were checked against vkd3d-proton's source and left: residency calls only ask whether an object is a heap or a resource,EnqueueMakeResidentonly calls the fence'sSignalthrough its vtable, andOpenSharedHandlereturns the runtime's own fence.cargo test --lib -- fence vtable wine unadopt, RTX 4060 Ti under Wine: 57 passed, 0 failed in 5 of 6 runs; in the first,bind::tests::wait_oldest_fenced_reclaims_in_flight_buffer_before_refusingfailed once while a title was running on the same card (it passes alone, 3 of 3). The Windows suite and smoke pair are still owed.AI use: Claude Code. Claude Opus 5.5 wrote the change; Claude Fable 5.2 ran the tests on the card and wrote this reply.
Edited: the first run of that command had one failure, which I had not read when I posted "0 failed"; the counts above are the corrected ones.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:13:16Z.
Follow-up (head
0797336e; the 57-line diff from76427620read). The gap is covered: under Wine, device #31CreateSharedHandleand #45SetEventOnMultipleFenceCompletionnow unwrap a fence proxy before the runtime sees it, and the overrides are added only underunder_wine(). The test checks both, with a proxy and a plain object mixed in one array, and that off Wine the proxy passes through unchanged. The other open points from my last comment (a Windows suite run and smoke pair, the size / stack, #3099) stand.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:40:37Z.
Triage (#1607) – head
0797336Overlaps #3099 (D260): both carry UnadoptGuard, FenceProxy and create_raw_fence for vkd3d-proton's vtable checks under Wine. #3099 targets
amd-dev, is a 151-file / 82k-line branch diff and conflicts. This PR targetsmain, adds #2477's in-place vtables (patch_in_place,in_place_kind), and covers main's newer fence and submit sites (sparse, vram, late_release, cpu_writes, present, title_textures,bind::poll_two_pass_feedback,sparse::pc_execute). For main, this is the one to review.No problems found in the parts read. The failing check is the PR description check: the smoke pair is still owed. The new top commit
0797336closes the gap the description listed: under Wine,CreateSharedHandle(#31) andSetEventOnMultipleFenceCompletion(#45) now unwrap fence proxies before calling the runtime, with a test.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T05:26:27Z.
merge-check claim
head:
0797336ee0Imported from ivall/xcl. Originally posted by throny on 2026-12-02T05:39:20Z.
merge-check
base: main
1c8b55147head:
0797336ee0merge: trial merge into base is clean (MERGEABLE)
build: cargo build --workspace on the merged tree: OK
tests: cargo test --workspace --no-fail-fast -- --test-threads=4: 2918 passed, 0 failed, 51 ignored; 25 SKIPPED lines (GPU tests that skip); 0 binaries ended abnormally (base 2909 by the other two trees, so +9 tests all pass)
review: Diff read (+1054 -78, 10 files, scan flags only expected unsafe vtable transmutes and VirtualProtect). Earlier review points checked against the head: fence proxy now runs main's fence hooks, queue Signal/Wait overrides and shared-handle / multiple-fence unwrap are under_wine() only, UnadoptGuard shares one body with its test, 9 new tests pass on Windows. Reading shows no Windows behaviour change beyond OnceLock loads per call. Still open from reviews: size (about 1050 lines, reviewers asked for a stack: raw-fence call sites, in-place tables, guard, proxy; the author offered to split), overlap with #3099 (targets amd-dev, one must be chosen), fixed caps (IN_PLACE_MAX 32, 64-entry tables), Wine branches of class_for and dev_create_fence untested off Wine, and the reports under Wine/AMD show the remaining failures (execute_indirect crash, intermittent sparse test at 4 threads) are partly not from this PR. None of the Wine paths were exercised on this Windows machine.
performance: not measured; no xcl-smoke pair on the PR, no retail run here
verdict: not yet: no xcl-smoke pair and no Windows suite run by the author (mine above is green), over the ~800-line limit without a split; the split / #3099 overlap needs the maintainer's decision.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T05:39:54Z.
Thanks for the merge-check. Two of the gaps are closed now: both
xcl-smokeblocks for head0797336eare in Regression run (RTX 5070 Ti, 60 s:main1,620 frames / 15,476 MB, this head 1,616 / 15,524 MB, no removal), and a whole-suite run on that card at this head is under Tested (2,905 passed, 0 failed, 51 ignored). The size is explained near the top: the fence/guard half and the in-place tables cannot be tested apart on an unpatched vkd3d-proton, because without the tables the first heap ends the process in an assertion. The #3099 overlap is for the maintainer to decide, as you say.AI use: Claude Code (Claude Opus 5.5) wrote this reply.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:17Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1730Patching in place rewrites the runtime's shared vtable, so every object of that class gets XCL's hooks and
is_adopted()returns true for it. That includes resourcesis_own_objectdeliberately leaves unadopted, objects the runtime creates internally, and objects XCL never adopted. Under Wine, after the first title resource is adopted, an XCL own-work upload buffer or a runtime-internal resource (e.g. a swapchain image) calls Release throughres_release. With late_release on, its last reference is held until the queues pass, which leaks memory or makes ResizeBuffers see outstanding references, and its Map goes throughres_maptoo.adopt()now also returns early onis_ext(v), so XCL_DRED'sname_for_reportnever names any later resource or heap. The hooks need to check per object (e.g. a side-table lookup) whether XCL actually adopted it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:17Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1252State objects (
Kind::StateObject, adopted throughdev_create_state_object) aren't inin_place_kindand never get a guard, so the runtime still receives them with XCL's copied vtable. Under Wine, a DXR title callingSetPipelineState1(stateObject)or GetProperties fails vkd3d-proton's state-object vtable check, the same assertion this PR fixes for pipeline states and root signatures.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:17Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1472UnadoptGuard::enterswaps the object's vtable pointer for every thread, not just the host call it wraps, so while a guard is live other threads see the object as unadopted and skip XCL's hooks and console slots. A pipeline state on the copy-table fallback is guarded inbind_pipeline_exacton thread A. On thread B,bind::held_psochecksis_adopted(p), gets false and returns None, so a deferred draw keeps no reference and the PSO can be freed under it. A title call on B to a console-only slot reads past the native table and crashes.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:17Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1141Not certain about this one: once 64 distinct native vtables have been guarded,
register_nativeonly logs a warning.orig_fnon a guarded object whose table wasn't recorded then falls through to*ext.sub(1)on the native table. Under Wine, after the cap (lists, allocators, and the copy-table fallback for pipeline states across interface versions), a thread callingorig_fnwhile another thread's guard has the native table installed reads the word before vkd3d-proton's vtable and calls through it, which is a crash or a wrong function.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:48:17Z.
Review: COMMENTED
Review of
0797336e: 6 finding(s). 4 are inline. These are on lines outside the diff:crates/xcl/src/hle/d3d12x/real.rs:11908:cl_execute_bundlepasses an adopted bundle list (extended vtable) to the runtime's ExecuteBundle without anUnadoptGuard, but ExecuteBundle is one of the native calls that checks a list's lpVtbl. Under Wine, a title bundle created through the adopted device fails vkd3d-proton's bundle-from-iface check (XCL's table instead ofd3d12_bundle_vtbl), so its draws are silently dropped or an assertion ends the process. Reset, CreateCommandList and ExecuteCommandLists got the guard.crates/xcl/src/hle/d3d12x/real.rs:4265:dev_enqueue_make_residentpasses the title's fence straight to the runtime withoutunwrap_fence, unlike CreateSharedHandle and SetEventOnMultipleFenceCompletion. Under Wine,ID3D12Device3::EnqueueMakeResident(..., fence, value)with a fence from CreateFence (now a FenceProxy) hands vkd3d-proton the proxy where it expects its own fence, so its type check asserts or it signals the wrong object and the title waits forever.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:12:45Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:32Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1730Right that the patched table belongs to the whole class. Under Wine every object of that class runs XCL's PC slots, adopted or not, and
is_adoptedis true for all of them. That is #2477's design, and the price of getting past vkd3d-proton's assertion. Here is what it does in the cases named:res_releaseon a resource XCL never adopted keeps its last reference until the queues pass the work in flight, then releases it (late_release). That is a delay, not a leak. The maps it clears are keyed by address and have no entry for such a resource.GetBuffereach present (present.rs:1500), so its last public reference can be held for a moment. AResizeBuffersin that moment would fail, andensure_swapchainruns again at the next present (present.rs:1496). I have not seen this in a run.res_map:console_bufferhas no entry for such a resource, and the PC'sMapruns as before (real.rs:2623).XCL_DREDnames: right. Under Wine,adoptnames only the objects made before their class's table is patched (real.rs:1537). It is a debugging aid. I'd leave it to a follow-up rather than grow this PR, which is already over the size limit.A check per object in every hook is a larger change, and not for this PR.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:35Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1252Not so on vkd3d-proton: it does not check a state object's table.
SetPipelineState1takes the object withrt_impl_from_ID3D12StateObject, a plainCONTAINING_RECORD(libs/vkd3d/vkd3d_private.h:6533at71cae091).GetPropertiesandQueryInterfacego through the title's table to the runtime's. The tables vkd3d-proton compares are those of lists and allocators, bundles and bundle allocators (bundle.c:241,:1925), and the assert-checked classes inin_place_kind. Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:38Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1472Yes, every thread sees the swap. That only matters for an object two threads use at once. The guard is for lists and allocators, and D3D12 does not let two threads use one of those at once: a second thread on one during its submit or reset is the title's own race. Pipeline states and the other
in_place_kindclasses are skipped by the guard (skips_guard,real.rs:1137; asserted atreal.rs:13341). So the case described needs the copy-table fallback, which is taken only whenVirtualProtectfails or past 32 tables. In 250 of our runs under Wine that logged the in-place write, none logged the fallback ("its vtable cannot be written"). Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:40Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1141The 64 count distinct native tables, not objects. vkd3d-proton has one table per class: lists, bundles, allocators, bundle allocators, and a fallback class when one happens. A run registers a handful. In those 250 runs the warning ("more than 64 native vtables") was never logged. Left as is: the warning says when it happens.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:39:43Z.
On the two points outside the diff, at head
2791e80c:cl_execute_bundlewithout a guard: right. vkd3d-proton'sd3d12_bundle_from_ifacecompares the table (bundle.c:1925at71cae091), returns NULL for XCL's, andExecuteBundledrops the bundle with a warning. The bundle now gets its native table back for that call (real.rs:11939). New testa_bundle_reaches_execute_bundle_with_its_native_table_only_under_wine, red without it.dev_enqueue_make_residentand the fence proxy: not so. vkd3d-proton'sEnqueueMakeResidentsignals the fence through its own table,ID3D12Fence_Signal(fence_to_signal, value)(libs/vkd3d/device.c:7116at71cae091), with no type check. On a proxy, that call is the proxy's Signal, which runs XCL's hook on the runtime's fence. Left as is.The four inline points are answered in their threads.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:37Z.
Review: COMMENTED
Review of
2791e80c: 6 finding(s) (2 high, 4 medium), most severe first.crates/xcl/src/hle/d3d12x/real.rs:1732: Under Wine, the in-place patch writes XCL's Resource/Heap/PSO/DescriptorHeap hooks into the runtime's shared vtable and registers it as an ext (register_ext(orig)), so every object of those classes, including XCL's own-work buffers and.... (inline)crates/xcl/src/hle/d3d12x/real.rs:11915:UnadoptGuardreplaces the shared object's vtable pointer for every thread, not just the caller, so while a guard is held other threads seeis_adopted(obj) == false, bypass XCL hooks, andslot_of(obj, ..)panics with 'adopted class'.... (inline)crates/xcl/src/hle/d3d12x/real.rs:5251: Under Wine,create_raw_fenceskips the hookeddev_create_fence, so XCL's internal fences (sparse, vram, title_textures, cpu_writes, late_release, alloc_pool, present, copy_scratch) are no longer in FENCES andend_titleno longer si.... (inline)crates/xcl/src/hle/d3d12x/list_x.rs:2340: see below.crates/xcl/src/hle/d3d12x/real.rs:4265: see below.crates/xcl/src/hle/d3d12x/real.rs:4290:dev_set_event_on_multiple_fence_completionreads*fences.add(i)forn > 0without checkingfencesfor null, so under Wine a call with n=1 and fences=NULL (which the runtime rejects with E_INVALIDARG) now takes an access violation.... (inline)On lines outside the diff:
Medium
crates/xcl/src/hle/d3d12x/list_x.rs:2340: Several internal fence sites weren't converted tocreate_raw_fence(list_x::note_submitted, console_heap.rs:244, gpu_awake.rs:297, uma_driver.rs:529/627, real.rs:593), so under Wine they get a FenceProxy that's added to FENCES with an extra reference.note_submittedcreates one proxied progress fence per queue and gpu_awake one per state, each leaking a proxy plus a pinned reference. Any of them signalled throughq.Signalon a non-adopted queue (e.g. from a non-adopted device, as in the shared-device tests) reaches vkd3d-proton as a proxy and hits its fence vtable assertion, the failure this PR fixes elsewhere.Medium
crates/xcl/src/hle/d3d12x/real.rs:4265: Not certain about this one, because it depends on how vkd3d-proton resolves the fence argument:dev_enqueue_make_residentstill passes the title's fence pointer straight through, and under Wine that's now a FenceProxy, unlike CreateSharedHandle and SetEventOnMultipleFenceCompletion, which unwrap it. If vkd3d-proton resolvesfence_to_signalwithimpl_from/unsafe_impl_fromrather than a COM call, its vtable assertion fires or it reads the 16-byte proxy as ad3d12_fence.unwrap_fence(fence), as in the sibling hooks, would fix it.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:37Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1732High: Under Wine, the in-place patch writes XCL's Resource/Heap/PSO/DescriptorHeap hooks into the runtime's shared vtable and registers it as an ext (
register_ext(orig)), so every object of those classes, including XCL's own-work buffers and DXGI/vkd3d-internal resources, runsres_release,res_mapand the other hooks and reportsis_adopted() == true, which defeatsis_own_object. An own-work upload buffer, or a swapchain back buffer released by the DXGI layer through the COM vtable, now goes throughres_release: it takesvram::lock_tracked_srv_lifetime(), AddRefs/Releases on every call, and on the last reference may be held bylate_release. Frees are delayed, ResizeBuffers can fail with outstanding back-buffer references, and Release calls from inside the runtime now take XCL's locks (a deadlock risk). Checking the object against XCL's own/runtime-internal objects inside the patched hooks (or keeping those classes out of the in-place patch) would restore the split.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:37Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 11915High:
UnadoptGuardreplaces the shared object's vtable pointer for every thread, not just the caller, so while a guard is held other threads seeis_adopted(obj) == false, bypass XCL hooks, andslot_of(obj, ..)panics with 'adopted class' because the native table isn't in CLASSES. If thread A holds_alloc_guard(cl_reset / reset_list) or_pso_guard(fallback PSO) while thread B uses the same object,bind::held_psoreturns None so a deferred draw holds no PSO reference,pc_heap_desc/pc_fntake the non-adopted branch, and a first-timeslot!/slot_ofon that object hits.expect("adopted class")and aborts. Onlyorig_fnknows about native tables. Calling the native function through the original table instead of swapping the object's vtable would avoid the cross-thread window.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:37Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5251Medium: Under Wine,
create_raw_fenceskips the hookeddev_create_fence, so XCL's internal fences (sparse, vram, title_textures, cpu_writes, late_release, alloc_pool, present, copy_scratch) are no longer in FENCES andend_titleno longer signals them tou64::MAX. Only the list_x cell fences are re-added throughtrack_end_title_fence. If a title or internal queue is blocked in a GPU Wait on one of these and the thread that would signal it is suspended or stuck,drain_gpuwaits until the 15 s watchdog kills the process, the case the cell-fence special case was added for. Tracking every raw fence forend_titlewould cover them all.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:54:37Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 4290Medium:
dev_set_event_on_multiple_fence_completionreads*fences.add(i)forn > 0without checkingfencesfor null, so under Wine a call with n=1 and fences=NULL (which the runtime rejects with E_INVALIDARG) now takes an access violation inside XCL's hook. Returning E_INVALIDARG for a null array would match the runtime.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:01:12Z.
Follow-up review of
2791e80c, since0797336(code reading only, not a merge-check;PR descriptionred) · 1 high, 2 mediumIn short: The PR keeps vkd3d-proton's own vtables under Wine and wraps the title's fences. Since
0797336eit was rebased onto5ad98adb, and the one real change is anUnadoptGuardon the bundle incl_execute_bundle, with a test. That guard is only on the path for callers that are not the title. A title'sExecuteBundlegoes through the console slot inlist_xand still hands vkd3d-proton the adopted bundle. The smoke pair names0797336e, not this head, which is whyPR descriptionis red.High
The title's
ExecuteBundlemisses the new guard.make_split(l::execute_bundle, cl_execute_bundle)(real.rs~1938, ~1684). Calls from the game image go tolist_x::execute_bundle(list_x.rs~1266), which calls the runtime throughpc(this, 27)with no guard.cl_execute_bundle(real.rs~11939), where the guard was added. So the case the commit message describes still happens on the path titles take.a_bundle_reaches_execute_bundle_with_its_native_table_only_under_wine(~15834) callscl_execute_bundledirectly and cannot catch it.Fix: add
let _bundle_guard = real::UnadoptGuard::new(bundle);before the PC call inlist_x::execute_bundle, and run the test through that function.Medium
create_raw_fenceat the call sites;UnadoptGuard;Checked and fine
GetCompletedValue/SetEventOnCompletion/Signalhooks on the runtime's fence (fence_pc_fn,real.rs~5223).CreateSharedHandle/SetEventOnMultipleFenceCompletionunwrapping are added only underunder_wine().UnadoptGuard::newreturns early when not under Wine, andenterchecksskips_guardbefore taking the lock (~1463-1480).UnadoptGuardbody, and the native-table list warns past its 64 entries.maingained invram.rsgo throughnative_queue_signal/native_queue_wait, which unwrap a proxy.amd-dev) was triaged earlier: this is the PR formain.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:40Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1732This is the first review's point, answered above (the price of patching vkd3d-proton's table, and what it does in each case). On the new part, Release calls from inside the runtime: vkd3d-proton drops its own references with its internal refcount, not through the COM table. For example, the swap chain releases its back buffers with
vkd3d_resource_decref(libs/vkd3d/swapchain.c:591and:837at71cae091). So those calls do not reachres_releaseor its locks. Keeping these classes out of the in-place patch brings back the assertion this PR fixes. Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:43Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 11915This is the first review's point, answered above.
slot_ofis new here, and it is the same case. It needs a second thread calling a list, an allocator or a fallback pipeline while a guard is held on it. D3D12 does not let two threads use a list or an allocator at once, and the fallback was not taken in 250 of our runs. Calling through the original table would not help: vkd3d-proton reads the table of the object passed as an argument (ExecuteCommandLists,Reset,ExecuteBundle), not only the one called. Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:48Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5251Right. On
mainevery fence made through the device goes intoFENCES(dev_create_fence), and under Winecreate_raw_fenceleft its fences out. It now adds each one it makes (track_end_title_fence). That makes the call this PR had added for thelist_xcell fences redundant, so that call is gone andensure_cell_fenceis back tomain's shape. New testa_raw_fence_made_under_wine_is_signalled_at_the_title_end, red without it. Head182896bc.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:50Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 4290Not so on the runtime this hook runs over: the override is added under Wine only, and vkd3d-proton reads
fences[0]with no null check forfence_count == 1(libs/vkd3d/device.c:7396at71cae091). It rejects only a zero count and unknown flags. A null array faults there either way. Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T21:22:53Z.
On the two points outside the diff, at head
182896bc:list_x::note_submitted,console_heap.rs:244,gpu_awake.rs:297,uma_driver.rs:529/627,real.rs:593): each one reaches vkd3d-proton as its own fence.note_submitted,console_heapand the check atreal.rs:593signal throughnative_queue_signal, which unwraps (real.rs:1341).gpu_awakemakes its fence insideown_work, so it is not wrapped (is_own_object).uma_drivermakes its fences before the device is adopted. There is one proxy per queue or state, not one per call.mainalso keeps a reference to every fence the device makes, inFENCES. Left as is.dev_enqueue_make_resident: answered in the comment above. vkd3d-proton callsID3D12Fence_Signalon the fence (libs/vkd3d/device.c:7116at71cae091), a COM call, so a proxy works. Left as is.The four inline points are answered in their threads.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:24:46Z.
Follow-up review of
182896bc, since2791e80c(code reading only, not a merge-check;PR descriptionred) · 1 high, 2 medium, 1 nitIn short: This push moves the
end_titletracking of raw fences intocreate_raw_fence(real.rs~5251-5263). Every fence it makes under Wine is now inFENCES, asmain'sCreateFencedoes for the rest, not only thelist_xcell fences. A Wine-only test covers it. The earlier High finding is unchanged: the title'sExecuteBundlestill hands vkd3d-proton the adopted bundle. The smoke pair names0797336e.High
ExecuteBundlemisses the bundle guard (still open). Console slot 27 sends calls from the game image tolist_x::execute_bundle(list_x.rs~1266), which calls the runtime throughpc(this, 27)with noUnadoptGuard. Only callers outside the title reach the guardedcl_execute_bundle. Fix: addlet _bundle_guard = real::UnadoptGuard::new(bundle);before the PC call inlist_x::execute_bundle, and run the test through that function.Medium
create_raw_fenceat the call sites;UnadoptGuard;Nit
a_raw_fence_made_under_wine_is_signalled_at_the_title_endreturns early when not under Wine, withoutskip_test, so on the Windows CI it passes without checking anything. Make it skip visibly, or drive the Wine branch the way the guard tests do.Checked and fine
track_end_title_fenceis now private and called from one place,create_raw_fenceunder Wine. Off Wine the fence goes throughdev_create_fence, which tracks it as before, so nothing is added twice.SYNC_GRAPHcell code is back to its earlier shape. The fence is tracked when it is made, not when a cell installs it, so a fence that loses the race to a cell is also signalled at the end.under_wine(), guard tests running the shipped body) are unchanged.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T21:56:18Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5159High: The FenceProxy vtable has only 32 slots, while the adopted fence class it replaces had scanned + EXTRA_SLOTS (64) entries, with a logged stub on every console slot past the PC interface. Under Wine, a title calling a console ID3D12Fence method at slot 32 or above through the proxy reads past the end of the 32-entry leaked Vec and jumps to whatever pointer follows on the heap, so it crashes where before it hit a logged S_OK stub. Sizing the proxy table like the adopted class, with the same stubs, would keep the old behaviour.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T21:56:18Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1252Medium: Kind::StateObject and Kind::PipelineLibrary are still adopted with extended vtable copies under Wine, but they're neither patched in place (
in_place_kind) nor guarded where they're passed to the runtime as arguments. If a title under Wine creates a raytracing state object (adopted) and callsSetPipelineState1(so)orAddToStateObject(desc, so), vkd3d-proton gets an object with XCL's extended vtable. By the PR's own premise it only accepts its own vtable, so this can trip the same lpVtbl assertion the PR fixes for PSOs and heaps. Adding them toin_place_kind(or guarding those calls) would cover them.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T21:56:18Z.
Review: COMMENTED
Review of
182896bc: 3 finding(s) (2 high, 1 medium), most severe first.Re-review at
182896bc. From the2791e80creview, the cross-threadUnadoptGuardvtable swap, theend_titleraw fences, the unconverted fence sites and the nullfencesarray weren't flagged again and look addressed. Still open: the in-place patch sends XCL's own-work and runtime-internal objects through the hooks, andEnqueueMakeResidentstill passes the fence proxy through. The three items below are new.crates/xcl/src/hle/d3d12x/bind.rs:2944: see below.crates/xcl/src/hle/d3d12x/real.rs:5159: The FenceProxy vtable has only 32 slots, while the adopted fence class it replaces had scanned + EXTRA_SLOTS (64) entries, with a logged stub on every console slot past the PC interface. (inline)crates/xcl/src/hle/d3d12x/real.rs:1252: Kind::StateObject and Kind::PipelineLibrary are still adopted with extended vtable copies under Wine, but they're neither patched in place (in_place_kind) nor guarded where they're passed to the runtime as arguments. (inline)On lines outside the diff:
crates/xcl/src/hle/d3d12x/bind.rs:2944:poll_two_pass_feedbackadds anUnadoptGuardonly in the adopted-queue branch. The else branch submits the same adopted copy list withq.ExecuteCommandListsand no guard. Under Wine, the feedback copy list (made through the adopted device, so it carries XCL's extended vtable) is submitted on a queue thatis_adopted()says isn't adopted, and vkd3d-proton's list check sees the wrong lpVtbl and rejects or asserts: the crash the guard was added to prevent on the other branch. Guarding both branches would fix it.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:14:44Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5159Right. The proxy's table now has the adopted fence's length, 12 PC slots and
EXTRA_SLOTS(real.rs:5172). Every slot past 12 is a logged stub, as before. New testa_fence_proxy_answers_every_slot_an_adopted_fence_hascalls the last slot. It fails without the change, because the process faults. Headcc2bf1fa.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:14:46Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1252Not so, as in the earlier thread on this line. vkd3d-proton does not compare a state object's table.
SetPipelineState1andAddToStateObjectboth take it withrt_impl_from_ID3D12StateObject, a plainCONTAINING_RECORD(libs/vkd3d/vkd3d_private.h:6533,device.c:8113at71cae091). A pipeline library is never passed to the runtime as an argument. Its own methods reach vkd3d-proton through XCL's table, with vkd3d-proton's own object. Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:14:48Z.
On the point outside the diff, at head
cc2bf1fa:poll_two_pass_feedback, the queue that is not adopted: right. The guard now covers both branches (bind.rs:2944). That branch runs only on a queue XCL did not adopt; in the title every queue is adopted, so it is reached by tests that share the device. No new test: it would need the two-pass feedback running on such a queue.The two earlier points still open are answered above: the in-place table and own-work objects in its thread, and
EnqueueMakeResident, where vkd3d-proton signals through the fence's table (device.c:7116).Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:16:56Z.
Follow-up review of
cc2bf1fa, since182896bc(code reading only, not a merge-check;PR descriptionred) · 1 high, 2 medium, 1 nitIn short: This push makes the fence proxy's table as long as an adopted fence's (12 +
EXTRA_SLOTS, with logged stubs for the console slots), so a title calling a console fence method on a proxy reaches a stub instead of running off the table. A test covers it. The test helper inalloc_pool.rsnow takes the list guard on both of its submit paths. The earlier High finding is unchanged: the title'sExecuteBundlestill hands vkd3d-proton the adopted bundle. The smoke pair names an earlier head.High
ExecuteBundlemisses the bundle guard (still open). Console slot 27 sends calls from the game image tolist_x::execute_bundle(list_x.rs~1266), which calls the runtime throughpc(this, 27)with noUnadoptGuard. Only callers outside the title reach the guardedcl_execute_bundle. Fix: addlet _bundle_guard = real::UnadoptGuard::new(bundle);before the PC call inlist_x::execute_bundle, and run the test through that function.Medium
create_raw_fenceat the call sites, the in-place tables,UnadoptGuard, the fence proxy.Nit
a_raw_fence_made_under_wine_is_signalled_at_the_title_endreturns early when not under Wine, withoutskip_test.Checked and fine
fence_proxy_vtable(real.rs~5170) now has 76 slots. Slots 0-11 forward to the runtime's fence or XCL's hooks, slot 12 iscompleted_value_address, and 13 onward are logged stubs, as on an adopted fence's table.a_fence_proxy_answers_every_slot_an_adopted_fence_hascalls the last slot.alloc_pool.rstest helper,UnadoptGuard::new(cl)now covers theExecuteCommandListspath as well as the native one. Test-only.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:33:26Z.
Review: COMMENTED
Review of
cc2bf1fa: 3 finding(s) (2 high, 1 medium), most severe first.Re-review at
cc2bf1fa. From the182896bcreview, the 32-slot FenceProxy table and the StateObject/PipelineLibrary vtables weren't flagged again. Thepoll_two_pass_feedbacksubmit now has its guard, but the Signal on the same path still passes a proxy (second item). Still open from earlier:EnqueueMakeResidentdoesn't unwrap the fence, and the in-place patch routes XCL's own-work and runtime-internal objects through the hooks.crates/xcl/src/hle/d3d12x/list_x.rs:1268: see below.crates/xcl/src/hle/d3d12x/bind.rs:2953: see below.crates/xcl/src/hle/d3d12x/real.rs:1141:register_nativekeeps at most 64 native tables and only warns past that, and for a guarded object whose native table wasn't recorded,orig_fn'sis_known_nativecheck fails, so it reads*ext.sub(1)from the native table (not an XC.... (inline)On lines outside the diff:
High
crates/xcl/src/hle/d3d12x/list_x.rs:1268: The title's ExecuteBundle never reaches the new bundle guard: console slot 27 sends title calls tolist_x::execute_bundle, which calls the native PC ExecuteBundle throughorig_fnwithout an UnadoptGuard. Onlycl_execute_bundle(non-title callers, real.rs:11945) got the guard. Under Wine, a title that records a bundle and calls ExecuteBundle from its own code hands vkd3d-proton the bundle with XCL's extended vtable, the case that drops or asserts. The new test only exercisescl_execute_bundle. Guarding inlist_x::execute_bundletoo would cover the title path.High
crates/xcl/src/hle/d3d12x/bind.rs:2953: The two-pass feedback fence is still made withdev.CreateFence(bind.rs:2770, not converted tocreate_raw_fence), so under Wine it's a FenceProxy, andpoll_two_pass_feedbackcallsq.Signalon it even when the queue isn't adopted, the case this PR handles for ExecuteCommandLists.IndirectFeedback::newruns during title recording on the adopted device, socopy_fenceis a proxy. When a DIRECT queue XCL didn't adopt submits a two-pass list, theelsebranch'sq.Signal(&fence)goes straight to vkd3d-proton with the proxy, which hits its fence-vtable assertion (process ends) or returns an error that setsfb.removedand turns feedback off. Creating that fence withcreate_raw_fence(or unwrapping before Signal) would fix it.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:33:27Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1141Medium:
register_nativekeeps at most 64 native tables and only warns past that, and for a guarded object whose native table wasn't recorded,orig_fn'sis_known_nativecheck fails, so it reads*ext.sub(1)from the native table (not an XCL pointer) and calls through it. Once the list is full, if one thread guards object X and another enters a hook on X and callsorig_fn(X, slot), it reads the 8 bytes before vkd3d's vtable as a table pointer and jumps through garbage. Growing the set (or refusing the guard when it can't be recorded) would prevent the crash the warning predicts.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:39:05Z.
@Foniass thanks. At
287a6918, rebased ontomain078358a0:ExecuteBundle: right. Console slot 27 goes tolist_x::execute_bundle, which called the runtime without the guard. It takes the guard now (list_x.rs:1268).a_bundle_reaches_execute_bundle_with_its_native_table_only_under_winecalls both entries, and fails on this one without the guard.skip_test("not under Wine")).Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:40:48Z.
Follow-up review of
287a6918, sincecc2bf1fa(code reading only, not a merge-check;PR descriptionred) · 2 mediumIn short: This push fixes the High finding from my last reviews.
list_x::execute_bundle, the path a title'sExecuteBundletakes, now holds anUnadoptGuardon the bundle, and the bundle test runs through it as well as throughcl_execute_bundle. The raw-fence test now skips visibly off Wine. The suite-count and size points are unchanged. The smoke pair names an earlier head.Medium
create_raw_fenceat the call sites, the in-place tables,UnadoptGuard, the fence proxy.Checked and fine
ExecuteBundlemissed the bundle guard.execute_bundle(list_x.rs~1266) takesreal::UnadoptGuard::new(bundle)before the PC call through slot 27. The test checks the native table is seen through bothcl_execute_bundleandlist_x::execute_bundle, and that the bundle's own table is back afterwards.a_raw_fence_made_under_wine_is_signalled_at_the_title_endcallsskip_test("not under Wine")instead of returning silently.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:42:55Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 1141This is the point answered earlier on this line. The 64 count distinct native tables. vkd3d-proton has a handful, and the warning never came up in 250 of our runs. Refusing the guard past the cap would not avoid a crash: vkd3d-proton would then get the adopted list and fail its own check (the read at
0x2b28). Left as is.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:42:58Z.
At head
d9afcbf1, on the two points outside the diff:ExecuteBundle(list_x::execute_bundle): fixed in287a6918, after Foniass's review. It takes the guard, and the bundle test calls both entries.Signal. It is made withcreate_raw_fencenow (bind.rs:2770). No new test: it needs the two-pass feedback running on such a queue.EnqueueMakeResidentand the in-place tables are answered above (vkd3d-proton signals through the fence's table,device.c:7116).Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:44:17Z.
Follow-up review of
d9afcbf1, since287a6918(code reading only, not a merge-check;PR descriptionred) · 2 mediumIn short: This push makes the two-pass feedback copy fence (
bind.rs,IndirectFeedback) a raw fence fromcreate_raw_fence, like XCL's other internal fences under Wine. Nothing else changed in the code. The suite-count and size points are unchanged. Tested now has a Wine CPU-only run at this head (100 passed), but no GPU run.Medium
create_raw_fenceat the call sites, the in-place tables,UnadoptGuard, the fence proxy.Checked and fine
create_raw_fenceoff Wine goes throughdev.CreateFence, as before. Under Wine it makes the runtime's fence and tracks it inFENCES, soend_titlestill signals the feedback fence.ExecuteBundleguard on both paths, the fence proxy's full table, and the visible skip off Wine from the last push are unchanged.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T22:55:11Z.
@Foniass both points are as answered above. The whole suite and the smoke pair for
d9afcbf1are queued on a Windows machine, and their counts go into Tested when done. The size stays one commit, for the reason given: the halves cannot be run apart on an unpatched vkd3d-proton.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T23:01:48Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5305Medium: The Wine branch of
dev_create_fencewraps the fence of every caller outside own-work in a FenceProxy and drops creator!'s IN_CREATOR re-entrancy bypass, so callers that used to get the raw fence now get a proxy. That covers several XCL sites that still calldev.CreateFence(console_heap.rs:244, list_x.rs:2341, real.rs:593, uma_driver.rs:529/627, gpu_awake.rs:297), any non-title caller through the adopted device vtable (vkd3d-proton's own swapchain, interop layers), and a runtime-internal CreateFence made while another creator is running. Any of them that reads the fence's internals or checks its vtable gets the 16-byte proxy, which means a vkd3d-proton assertion or a garbage read. Keeping the IN_CREATOR bypass and converting the remaining internal sites tocreate_raw_fencewould limit proxies to title fences.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T23:01:48Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5251Medium: Under Wine,
create_raw_fenceon a device that isn't adopted goes throughdev.CreateFenceand never callstrack_end_title_fence, although its doc says its fences go into FENCES. If XCL code on a non-adopted device (e.g. a second device) makes an internal fence and has a queue Wait on it,end_titledoesn't signal it to u64::MAX, sodrain_gpuwaits until the 15 s watchdog ends the process. Tracking the fence on both branches would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T23:01:48Z.
Review: COMMENTED
Review of
d9afcbf1: 2 finding(s) (2 medium), most severe first.Re-review at
d9afcbf1. Correcting my182896bcnote: StateObject/PipelineLibrary still aren't patched in place or guarded, andUnadoptGuardstill exposes the native vtable to other threads while it's held (now via the bundle guard). Both are still open, along withEnqueueMakeResidentnot unwrapping the fence proxy and the in-place patch hooking XCL's own-work and runtime-internal objects. Two new items below.crates/xcl/src/hle/d3d12x/real.rs:5305: The Wine branch ofdev_create_fencewraps the fence of every caller outside own-work in a FenceProxy and drops creator!'s IN_CREATOR re-entrancy bypass, so callers that used to get the raw fence now get a proxy. (inline)crates/xcl/src/hle/d3d12x/real.rs:5251: Under Wine,create_raw_fenceon a device that isn't adopted goes throughdev.CreateFenceand never callstrack_end_title_fence, although its doc says its fences go into FENCES. (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T23:13:12Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5305Not changed. A proxy for every fence made through the adopted device, outside XCL's own work, is the Wine form of what
maindoes: theredev_create_fenceadopts every such fence. TheIN_CREATORcase is D3D12Core calling the device's public methods from inside another one. vkd3d-proton never does that for fences: it has noID3D12Device_CreateFencecall of its own (at71cae091the only one inlibs/vkd3dis the definition,device.c:7178). Its swap chain makes its fences internally. The XCL sites listed each reach vkd3d-proton with its own fence, as answered above:native_queue_signalunwraps,gpu_awakeis own work, anduma_driverruns before the device is adopted.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T23:13:14Z.
Code review location:
crates/xcl/src/hle/d3d12x/real.rs; line 5251Not changed: that matches
main. On a device XCL did not adopt,CreateFencegoes straight to the runtime onmainas well, and its fence never entersFENCESthere either.FENCESholds the fences made through the adopted device, andcreate_raw_fencekeeps that. The doc line says "onecreate_raw_fencemakes under Wine", meaning the branch that skipsdev_create_fence.Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T23:13:16Z.
On the items this review carries over, at
d9afcbf1. Each is answered in its thread with the vkd3d-proton line it rests on:SetPipelineState1andAddToStateObjecttake them with a plainCONTAINING_RECORDand no table check (vkd3d_private.h:6533,device.c:8113at71cae091). A pipeline library is never passed as an argument.UnadoptGuardon other threads: it covers lists, bundles and allocators, which D3D12 does not let two threads use at once. The in-place classes are skipped.EnqueueMakeResident: vkd3d-proton signals the fence through its table (device.c:7116).No code change for them.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.