D3D12.X: the presenter's copy of the title's image moves it to COPY_SOURCE and back #1535
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1535
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1535"
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?
@dhanush2412 on GitHub · 2026-11-24 17:22 UTC · original
dhanush2412:d3d12x-present-source-barrier→main· +15 −0 · 1 files · 1 commits · draftPart of #1452. With
XCL_D3D12_DEBUG=1a 130-170 s run of the retail game (retail title 1.0.2.1, Series X) reports 2,934 xINVALID_SUBRESOURCE_STATEonCopyResource(the source is inRENDER_TARGET, needsCOPY_SOURCE), about one per presented frame, and 2,925 x on the title's nextClearRenderTargetViewof the same image (the layer then tracks it asCOPY_SOURCE). The presenter's copy (present.rs,present_now) put a barrier on the back buffer only. This moves the title's image toCOPY_SOURCEfor the copy (and the frame-dump readback) and back toRENDER_TARGETafter it. Off by default (XCL_PRESENT_SRC_BARRIER=1): the stateRENDER_TARGETis what the debug layer showed in all 2,934 cases, not something XCL tracks, so a title that presents a resource in another state gets a wrong barrier.What is in it
crates/xcl/src/hle/d3d12x/present.rs:present_src_barrier()(the switch) and the two transitions aroundCopyResourceinpresent_now.Tested
cargo test --release --workspace -- --test-threads=4: 776 passed, 0 failed, 41 ignored (SKIPPED GPU tests on this adapter:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows))CopyResourceerrors 2,934 -> 7,ClearRenderTargetViewerrors 2,925 -> 26, allINVALID_SUBRESOURCE_STATE8,808 -> 2,203. The device is still removed at the end of that run (#1452), so this does not fix that.Regression run
main:
PR:
Not tested
RENDER_TARGETXCL_FRAME_DUMP), not compared pixel by pixelAI use
@srcamarda on GitHub · 2026-11-24 18:14 UTC · original
#1535 and #1536 on AMD RDNA3 (RX 7800 XT) with the debug layer: #1535 removes the presenter's errors here too (~4 500 → 0); #1536's case does not come up on this card in 150 s; no fps drop in either setting
Both PRs were merged together onto
main9e3831elocally (clean merges, not pushed; local merge commit944fc18). Each switch was then turned on alone and together.Setup
XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=150, Enter (= A) at 30 / 40 / 50 s (title screens into the start of loading).Debug layer (
XCL_D3D12_DEBUG=1). XCL logs only 8 messages per id, so for these five runs both builds carried the same local diagnostic, not part of either PR: every debug-layer message counted by id, call and actual state, printed at the end of the run. Totals over 150 s:mainXCL_PRESENT_SRC_BARRIER=1XCL_UPLOAD_BARRIER=1CopyResource, source inRENDER_TARGETClearRenderTargetView, inCOPY_SOURCECopyTextureRegion, source inNON_PIXEL|PIXEL_SHADER_RESOURCE(0xC0)IASetIndexBuffer/IASetVertexBuffersNo device removal or crash in any of the five.
CopyResourceand the title's nextClearRenderTargetViewboth go to 0 on this card as on the RTX 3060.IASetIndexBufferinCOPY_DESTcase on this card in these 150 s, not even onmain, so these runs show neither the fix nor a regression. Your 130–170 s runs reach further into the world load than mine.CopyTextureRegionwith its source in a shader-resource state (0xC0), about 200–320 per run. The ids outside 538 are the same in every column: 745 (simultaneous-access / buffer still referenced onExecuteCommandLists/UpdateTileMappings), 677, 679, 680, 1047, 1422.Smoke runs, no debug layer (
scripts/smoke.ps1 -Seconds 60, interleaved, two rounds):main9e3831eNo device removal or crash. The drop in your PR smoke block (presents 42 22 8, peak commit +3.3 GB, with the switch off) does not reproduce here.
Tests:
cargo test --workspace --no-fail-fast -- --test-threads=4on the merged tree: 776 passed, 0 failed, 41 ignored, with the switches unset and with both set to 1.SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows), in both.Not tested
Claude Code (Claude Opus 5.5), from runs on the hardware above.
@Filip722 on GitHub · 2026-11-24 18:14 UTC · original
RTX 5060 Laptop GPU test on Bazzite 44 (NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton
4522cc1a8b1347f1ab1b0f7b14a23ed9444d95d1+). I tested exact #1535 headca44a681264c7b71132eee9e96e99f896c735661on main9e3831e1f570d3646e53ab753b19ec07eb8f1485with the dedicated presenter queue and local storage/residency changes.Two focused Windows MSVC GPU tests ran under Proton and passed with zero skips. The added test started with a known render target, cleared it green, copied it on the dedicated presenter queue using the source barriers and checked the green readback. It then cleared the source red on the title queue and checked that readback as well.
Matched Series X title runs used the same executable and initial data/cache seeds. With the flag unset, the trace recorded 2,539 presents and 76,286 storage requests with zero failures. With
XCL_PRESENT_SRC_BARRIER=1, it recorded 2,595 presents and 78,692 requests with zero failures. Both reached loading artwork and stopped at the same title watchdog. Neither logged a pipeline-bind timeout, D3D12 device removal or NVIDIA Xid. The Windows D3D12 debug layer was unavailable under Proton, and the title source state at PresentX was unverified.AI assistance from OpenAI Codex (GPT-6.2-Sol high) for the focused test, paired runs and report.
@DavidM1911 on GitHub · 2026-11-24 19:05 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.