Repository navigation
D3D12.X: triple-buffer Presenter to avoid per-frame fence stalls - #674
RandomGithub12309 wants to merge 2 commits into
Conversation
|
Retest after the resize fix I reran the same synthetic frame-dump fixture on Each run verified 28 presents, three resizes, and 14 BMP captures. All dimensions and 250,944 sampled pixels matched in each run. The D3D12 debug layer was active on the RTX 3080 Ti and reported no errors. The new stock Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. I used Earlier reproduction and scratch controlTested A synthetic frame-dump test stopped at the first resize (640×360 → 768×432) on both In a scratch control I drained the present queue immediately before Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. I used Not tested Queue changes, device removal, and retail performance. AI use Codex with GPT-6.2 Sol wrote the scratch fixture, ran the tests, and drafted this report. |
93f147c to
d2682eb
Compare
|
Thanks @thehollowedone for catching error 921! Updated PR #674 at
Re-verified on RTX 5050 ( |
|
Test run of Tested
Review: Before Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
AMD / wave64 data point (the "Not tested" axis): the present-module tests pass on an AMD Raphael iGPU (RDNA2, native wave64) and on NVIDIA wave32 at this PR's head. Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB; AMD Radeon(TM) Graphics (Raphael iGPU, 485 MiB, wave64, no mesh shaders) and RTX 3080 Ti 12 GB (driver 621.01, wave32). PR head Runs (
Not tested: the frame-dump resize regression reported elsewhere (D3D12 error 921 at 640×360 → 768×432) — these unit tests do not exercise resize; long sessions, other titles. AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the tests and wrote this report from their logs; a human reviews it before posting. No code changes. |
Test report: #674 under Wine (Linux, NVIDIA): the swap chain is DXVK's DXGI on vkd3d-protonThe other reports are Windows runs. Under Wine the 3-buffer swap chain is DXVK's DXGI presenting vkd3d-proton queues, a different present path. GTA VI runs the same on the base and this PR, and the present module tests pass under Wine. Setup
Unit tests (lib test binary under Wine, GTA VI 1.0.2.1 (my own dump; 60 s runs with
No swap-chain or (The first pair. Not tested
AI use: Claude Code (Claude Opus 5.5) built both commits, ran everything above on the machine above and wrote this report. The blocks and counts are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one. |
|
Merge note for this PR and #450 ( More than text is involved. #450 keeps one overlay upload buffer on So whichever lands second should probably move the overlay into For the rest of the queue: of the 24 PRs that are green with full Tested counts, these two and the Read-only, not built. AI-assisted (Claude Code). |
|
I reran the resize path on Windows 11 build 26300, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. The fixture required an active D3D12 InfoQueue. |
|
Regression run of Tested
main (e50836b): this PR (d2682eb): What this does and does not say
Not tested
AI use
|
|
Code read of
AI use: Claude Code, Claude Sonnet 5.5, read the code at the head above and drafted this; a person checked it before posting. |
Previously present_now signaled p.fence before sc.Present(0, DXGI_PRESENT(0)), leaving DXGI's internal Present queue work unordered behind p.fence. When ensure_swapchain called sc.ResizeBuffers or present_now moved queues, old swap-chain back buffers could be freed while still in use (D3D12 error 921). Extract present_frame_on so q.Signal runs after sc.Present (while still fencing submitted copy command lists on Present failure), extract drain_and_reset_for_queue, add drain_queue to wait for all in-flight copy and Present work before ResizeBuffers and queue switches, handle ResizeBuffers device removal via fence::api_error, and add regression tests for dimension/format resizes, queue switches, timeouts, and ResizeBuffers error recovery. Assisted-by: Antigravity (Gemini 4 Neon)
Rotate three command allocators, command lists, and swap-chain buffers in Presenter so PresentX no longer blocks on the previous frame's fence every frame. Stacked on xcl-dev#711.
d2682eb to
9699b96
Compare
|
Updated at
|
PR #674 — D3D12.X triple-buffered Presenter verificationPR head What is in it
Tested
Failures
Workspace Not tested
AI use
|
Stacked on #711; only the top commit belongs here.
Triple-buffer
Presenterincrates/xcl/src/hle/d3d12x/present.rssoPresentXrotates across three(ID3D12CommandAllocator, ID3D12GraphicsCommandList, copy_source, dumps, fence_val)slots and a 3-buffer flip-discard swap chain instead of blocking on the previous frame's fence on every present.What is in it
f98dc20(from D3D12.X: drain present queue after Present before ResizeBuffers #711): drain present queue afterPresentbeforeResizeBuffersand queue switches.9699b96(this PR) incrates/xcl/src/hle/d3d12x/present.rs:PresenterwithPRESENT_SLOTS = 3PresentSlotentries and a 3-buffer swap chain, reclaiming completed slots non-blockingly and waiting only when rotating into an in-flight slot (never treatingu64::MAXdevice-removed sentinel as completed).p.disabled |= matches!(&e, FenceError::Removed(_))inensure_swapchainafter a faileddrain_queueso a failedSignalis not cleared.drain_and_reset_for_queueon a non-Removeddrain failure (e.g. timeout) so in-flight swap-chain and slot resources stay alive until the GPU finishes.triple_buffer_slot_completion_and_wait_logicandtriple_buffer_present_and_resize_drains_queue_cleanly(covering multi-resize presents and queue-move drain timeout retention).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)stable-x86_64-pc-windows-msvc(debug for unit tests, release forsmoke.ps1).cargo test -p xcl --lib hle::d3d12x::present -- --test-threads=1 --nocapture: 8 passed, 0 failed, 0 ignored (0 skipped).cargo test --workspace -- --test-threads=4 --skip fuzz_validate_and_gpu:xcllib 939 passed, 0 failed, 25 ignored (SKIPPEDon this adapter: wave64-only GPU tests andpso_measurement_compiles_an_exact_synthetic_recordbecause Windows Developer Mode is off;gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}excluded due to pre-existing0x8007000ECreateComputePipelineStateOOM on this adapter).scripts/smoke.ps1release build at9699b96vsmain(8e87fc7).Regression run
Not tested
0x887A002D), AMD/Intel/wave64 GPUs, Wine/Linux, interaction with D3D12.X: XCL_OVERLAY draws fps / stats into the shown frame #450 (XCL_OVERLAY, not yet onmain), and gameplay beyond the 60 s smoke window.AI use
|=onp.disabled, queue-move drain timeout retention, stacking on D3D12.X: drain present queue after Present before ResizeBuffers #711), ran the tests andscripts/smoke.ps1on the hardware above, and updated this description.