Repository navigation
Wine: raw internal fences + native-vtable guards at host-runtime calls (rebased on amd-dev) - #3099
crazymanjared wants to merge 6 commits into
Conversation
… only dependency, 7c has the vtable machinery but not the helper
… run58 boot crash (adopted allocator/PSO/fence args rejected by Wine-host vkd3d from-iface check; E_INVALIDARG at first CreateCommandListX, deterministic 2/2). Guard machinery (EXT_FAST/NATIVE_FAST fast tables, orig_fn native-table passthrough) + guarded runtime call-sites (CreateCommandList/1, Reset, placed resources, RTV, Set/ClearState, alloc Reset, ExecuteCommandLists both paths) + FenceProxy per e4f88d68 (fences keep native vtble under Wine). create_raw_fence NOT duplicated (f90b6cd version kept). Skipped: uav ensure_lazy_mapped, q_release forget_queue, tests (7c lacks those sparse helpers / test hunk). Not for merge (matches e4f88d68 posture). (cherry picked from commit eb05e33)
…8 (run59 boot wall: E_INVALIDARG int-3 at game+0x2474ce1 right after allocator wrap, BEFORE queue xcl-dev#35 ExecuteCommandListsX entry log = console submit/reset path unguarded: kickoff_x exec x2 + reset, split/deferred_segment/record_deferred/reset_pc reset_list guards + sync-graph & copy_scratch & alloc_pool.executed fences -> create_raw_fence (FenceProxy consistency). Same 0x80070057 pattern = per next-order item 1c. Skipped (7c lacks helpers/tests): ensure_lazy_mapped, note_queue_wait, log_sync_state, all test hunks. (cherry picked from commit a4fedba)
…tats() (E0599 follow-up to 4b60f6ca RwLock switch; this exact working tree built the deployed run87 exe b39a343b7f52a93a0d0ec15533c55b2b)
…me objects XCL submits its readback/upload command lists straight onto its internal queue; under Wine the runtime's from-iface check (query-hazard scan of ExecuteCommandLists, command.c) answers NULL for class-wrapped lists and the following list->query_ranges read faults with 0xc0000005 at a fixed offset (observed on retail titles at ~2.5 min in, under shader-storm load). Create them through the runtime's own CreateCommandList/Allocator slots, as create_raw_fence already does for fences. (cherry picked from commit 603026b3be7d5ce01e733c35f4562c42e903bf8f)
…evice queues / heap retirement with raw fences, not CreateFence FenceProxies (run88 wall t22.783: vram::signal_device_queues -> q.Signal(FenceProxy) onto device queue; vkd3d submission worker d3d12_fence_add_pending_signal_locked read all-ones + title thread faulted mid d3d12_command_queue_signal trace. Same face as the old 16 s signal_queues_with f.clone() crash, fixed x1 on amd-wine; never went upstream (dev.CreateFence unfixed on 8942/f33 per xcl-dev#56(a)). Both sites match amd-wine-pre-rebase-1126's proven face (2349+2368). Site 917 left unchanged (single variable).
fe6a8c2 to
b8ec6a4
Compare
|
merge-check
|
|
This PR targets AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head b8ec6a4, diff read, not a merge-check; base
Fine: the Wine-only parts ( AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
What
Makes XCL's internal D3D12.X object usage correct against a host vkd3d-proton that identifies its own objects by vtable-table equality — which is exactly what happens when XCL runs on Wine with d3d12/d3d12core as native vkd3d-proton DLLs. Two violation classes, 6 commits, each a single-variable step. Run data for every claim lives in #846 (I'm
crazymanjaredthere; the run-numbered entries in commit messages map 1:1 to that thread).Rebased 2026-11-29: the branch is now the guard/fence stack ported onto current
amd-dev(36e16cf4, includes #3369 and thesubmit_thread/#3304split-entry machinery) as 6 clean commits. The previous 7c-based head (fe6a8c26, a 292-commit face against the then-base) is superseded; everything it proved still stands, see Results.Why this fails on Wine today
d3d12_command_list_from_iface-style checks comparelpVtblagainst its own embedded/default/profiled tables and return NULL for ext-table objects; several call sites then dereference without a NULL check. Bareamd-dev(7c-era, same face as runs 85/86 on the 8942 base) dies at title boot on Wine withE_INVALIDARGint-3 (game+0x2478b7b/game+0x2474ce1), 0.5 s after prep completes, 0 presents — deterministic 2/2. WithoutUnadoptGuard(git log -S UnadoptGuardfinds nothing upstream) nothing else on this path is even testable.FenceProxyobjects reaching the host submission path. vkd3d-proton's submission worker blind-casts fences it receives — a vtable-swapped proxy faults. XCL hands fences into queue Signals from the vram retire/seal machinery (vram.rs, run88 wall at t22.783) and from sparse copy-back submits (GreemSC hit the same class independently — The retail title 1.0.2.1 (RTX 5070): reaches the end of the first-run setup, then deterministic 0xC0000005 write at 0x0 in game_scarlett_master.exe+0x23cf683 #846 comment 7225087672).vkd3d_submission_has_query_reset_hazardcallsd3d12_command_list_from_iface(command_lists[i])and dereferenceslist->query_ranges.countwithout a NULL check — an XCL ext-table list in an ECL batch = AV read atNULL+0x2b28(observed atd3d12core+0x4c75d7, run 87 at t126.817 on the 8942 base). This PR makes XCL's sparse readback/upload lists and allocs unwrapped runtime objects at creation; a host-side NULL check next to that scan would be the complementary fix.The stack (on amd-dev
36e16cf4)ec26e0accreate_raw_fence(orig-slot pattern) — helper for everything below; the tree has the vtable machinery but not this helper48438cddUnadoptGuard+FenceProxycore: guard machinery (fast tables, orig-fn native-table passthrough) + guarded host-call sites (CreateCommandList, placed resources, heap, RTV, PSO bind, allocator Reset incl.reset_pc_allocator, ExecuteCommandLists both paths) + queue Signal/Wait fences unwrapped (queue_signal_now/queue_wait_now/ PC-caller entries)dfeaac47list_x/alloc_poolsites: kickoff_x exec/reset, split/deferred_segment/record_deferred/reset_list guards + sync-graph, copy_scratch and alloc_pool.executed fences →create_raw_fencee9e44984CLASSESlock conversion from the RwLock switch (compile follow-up)66a49b3cnew_stateupload slots / rb list /take_or_alloc_rb_job— kills the query-hazard class (3) at the sourceb8ec6a4fvram.rs: device-queue signal + heap-retirement fence sites →create_raw_fence(run88 wall:signal_device_queuesfanned FenceProxy ptrs into queue Signals → dual AV)Rebase notes (deltas vs the 7c-era face): the XG
CopyFromSubresource7-arg ABI commit is gone as content — current amd-dev carries the newer 4-argument-copy_argsform natively;readback_after's bounded-wait guard is gone — the function was refactored into the async rb-queue design;ExecuteCommandListsnow goes through the base's caller-split entries with the UnadoptGuards kept inside both branches;queue_wait_nowgained the fence unwrap the base only had on the Signal side.Results on Wine (GE-Proton11-14, RX 6950 XT / RDNA2, vkd3d-proton master, RADV 26.3.1)
Every commit's content is proven by an actual GTA6 title run on this box (run numbers in messages ↔ #846), first on the 7c lineage, then re-proven end-to-end on the 8942 lineage:
48438cdd-class guards (run87): boot assert cleared, hazard wall reached66a49b3c-class raw lists (run88): hazard wall passed, 764 list-writes, zero from_iface faultsb8ec6a4f-class vram raw fences (run89): all walls cleared — world entry, 30 fps cruise, 3,046 presents, first presenting in-world run on this hardwareThe rebased chain here compiles clean (
cargo build --release -p xcl --target x86_64-pc-windows-gnu, 0 errors); the run-proven trees it ports from are runs 87–90. Not NVIDIA/Windows-tested — these paths only activate where the host runtime is vkd3d-proton under Wine, so Windows/NVIDIA behavior should be untouched by construction (guards adopt/unwrap only in ext contexts); would appreciate a maintainer sanity pass on that framing.Follow-up candidates (deliberately NOT in this PR):
sparse.rs's async-rb fences on the new base (lines ~2948/~4041,dev.CreateFence— the FenceProxy design may cover them, pending our own fault data on this base);vram.rssite ~917 (unported, no observed face).Review request: @GreemSC — you independently hit class (2); a second pair of eyes on the vram + ECL guard sites would be great. @tiagonleal — per #846 this is the guard-set landing place including the
Reset(allocator, pso)coverage you asked for (reset_pc_allocatorwraps the raw allocator reset inUnadoptGuard).