Skip to content

D3D12.X: refresh fence mirrors after queued rewinds - #906

Open
rison1337 wants to merge 1 commit into
xcl-dev:mainfrom
rison1337:fix/fence-slot12-rewind
Open

rison1337 wants to merge 1 commit into
xcl-dev:mainfrom
rison1337:fix/fence-slot12-rewind

Conversation

@rison1337

@rison1337 rison1337 commented Nov 24, 2026 •

Copy link
Copy Markdown

Fence slot 12 could keep returning 40 after a blocked queue lowered the native fence to 3. The completion event could fire before the queue reached that signal.

What is in it

  • Keep completion events and sample for missed changes after a 10 ms idle wait. A timer tick only stores a changed value.
  • Add a D3D12 regression test that holds the queue until the early refresh is visible.

Tested

  • Windows 11 build 26300, RTX 4060 driver 32.0.16.2101, Ryzen 5 7500F, Rust 1.100.0 MSVC. Local NTFS debug build, XCL release builds for smoke.
  • Focused test on f4ce27c with only the test applied reproduced native 3 and mirror 40. It passed on 29e21fb.
  • cargo test --locked --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --nocapture: 699 passed, 3 failed, 41 ignored, 4 reported skips (2 wave64, 2 D3D12 debug layers). The cubemap assertion matches #447. The other two failures followed from the poisoned mutex.
  • Serial full workspace retest: 702 passed, 0 failed, 41 ignored, 3 reported skips (2 wave64, 1 D3D12 debug layer). The reported skips are counted as passing by the Rust harness.

Regression run

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 952 (PresentX 952)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 9319 MB
xcl-smoke v1
commit: 29e21fb0e299131bee0bb23d49ed2051c4a16e36
gpu: NVIDIA GeForce RTX 4060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1325 (PresentX 1325)
presents per 2 s (last 3): 61 60 62
device removals: 0
crashes: 0
peak commit: 9325 MB

Not tested

AMD and gameplay past startup.

AI use

Codex (gpt-6.2-sol) wrote the code and test and summarized the contributor's Windows runs.

A threshold completion event can fire while the GPU is still
waiting to signal the lower value. Keep the event path and also
sample the native fence after a 10 ms idle wait. Only write
changed values on timeout so the polling does not wake the title
while its fence is idle.

Exercise a rewind queued behind a blocked fence on a real D3D12
queue. Without the fix the native fence becomes 3 and its cell
stays at 40.

Assisted-by: Codex (gpt-6.2-sol)
@dcastell1

Copy link
Copy Markdown

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
714 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than main: the fence-mirror refresh after queued rewinds is covered and runs green; nothing else changes verdict.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

@Diskuss

Diskuss commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested on AMD Radeon RX 9070 XT (RDNA4) at 29e21fb0e299131bee0bb23d49ed2051c4a16e36

Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, GPU driver 32.0.32015.7029, Rust 1.100.0 (x86_64-pc-windows-msvc), DXC 1.9.2602.17, debug build.

Tested:

  • cargo build --workspace: succeeded.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: summed over all test result: lines, 702 passed, 0 failed, 41 ignored.
  • the_cell_follows_a_delayed_queue_rewind: passed in the full suite. Run on its own 5 times with cargo test -p xcl --lib the_cell_follows_a_delayed_queue_rewind -- --test-threads=1, it gave "1 passed" every time (5/5, about 0.1 s each).
  • SKIPPED lines: 0. Device removal: none seen in the log.
  • Comparison with main (1ec4c98): main gave 715 passed, 0 failed, 41 ignored; this PR gives 702 passed, 0 failed, 41 ignored. The 13 fewer passed tests are expected: the PR branch is 21 commits behind main, so it has fewer tests.
  • Until now this PR was tested only on an RTX 4060, so this run covers an AMD driver.

Not tested: retail title / scripts/smoke.ps1 (no game files), release build.

Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.

Correction (hidden skips): "0 SKIPPED" above means no SKIPPED line appeared in the normal run. A later -- --nocapture run on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools / d3d12SDKLayers.dll). libtest captures their output, so they show as ok: e2e::test_title_draws_with_a_root_signature_under_the_debug_layer and texture_states::uploads_start_from_each_subresources_state. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head 29e21fb onto main 09940bb, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 706 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). post-rewind fence-mirror refresh green; mirror-upload flake hit in this lane.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@xpatfussy69x

Copy link
Copy Markdown

Test report for head 29e21fb as pushed (not merged onto current main) – NVIDIA, wave32.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (Ampere, 32-lane waves only), driver 32.0.16.2124; AMD Ryzen 5 7500F; 32 GB RAM; Windows NT 10.0.26300; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); debug; DXC 1.9.2609.5
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 702 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests on this adapter: 2 (no wave64)
  • this PR's tests: the_cell_follows_a_delayed_queue_rewind ran and passed
  • no XCL_SAMPLE_* data set (game-data tests not run)

Not tested

  • a smoke run on a title; AMD / native wave64; release build; the head merged onto current main

AI use

  • Claude (Claude Opus 5.5) wrote the script that ran the suite on my PC, read the log and wrote and posted this report with my approval; the run is mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants