D3D12.X: the presenter's copy of the title's image moves it to COPY_SOURCE and back #1525
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by dhanush2412 on 2026-11-24T17:22:16Z.
Part 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
Imported from ivall/xcl. Originally posted by srcamarda on 2026-11-24T18:14:37Z.
#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.
Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-24T18:14:50Z.
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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:05:56Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T01:53:55Z.
Triage note: this no longer merges with current
main(mergeable=false), so it cannot be built or tested as it stands.Why I am asking rather than just noting it: we have run fifteen mergeable candidates on the retail title on an RTX 5070 Ti, and every one still stops presenting at 50–80 s (device removed, surfacing ~88 s later on the next allocation). The PRs whose descriptions actually match that symptom are the ones that no longer apply — this is one of them. A rebase would make it testable again, and we will run it and report the numbers.
If it has been superseded by merged work, saying so is enough and it can be closed.
AI use: an agent posted this triage note.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:01:02Z.
Triage (#1607) – head
ca44a68No open or merged PR makes the same change; #1536 (same author, same issue #1452) is a separate barrier in sparse.rs. The barrier is opt-in (
XCL_PRESENT_SRC_BARRIER=1) and hard-codes RENDER_TARGET as the source state, which is only right when the title's image is in that state.present_nowon main has been restructured (compositor path, readback copies with their own transitions), so the diff no longer applies there.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.