D3D12.X: a capture copies the textures its call reads #2421
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2431"
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 madaraXor on 2026-11-25T18:38:02Z.
The textures of a captured call get their contents: each is copied on the GPU where the call stands and read back after the submit. Part of #675.
A copy recorded on the title's list sees the uploads of title memory that submit makes and what earlier commands of the list wrote; a read at record time or after the submit would not.
Stacked on #2430; only the top commit belongs here.
What is in it
hle/d3d12x/capture/textures.rs:copy_allrecords aCopyResourceof each texture into a texture of XCL's own on the list at the call;read_backcopies them to read-back buffers on a queue of XCL's own once the title's queue is past the list, and writestex_<id>.bin(all subresources and planes in the layout ofGetCopyableFootprints).capture.rs,real.rs: the two calls.partial:) is not copied and goes intoleft_out, so noALL_SUBRESOURCEStransition is made from a state some subresource is not in (copyable). Test:a_texture_in_no_one_state_is_not_copied.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on5f8eb9c: 1430 passed, 6 failed, 46 ignored. The failures:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 540),hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory(#650) and the e2e teststest_title_runs_and_game_folder_is_untouched,test_title_draws_with_a_root_signature_under_the_debug_layerandtest_title_runs_under_the_debug_layer_with_dred, which fail onmaine1d84b7on this machine too (its whole suite: 1416 passed, 7 failed, 46 ignored);hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryfailed in this whole-suite run; it fails in the whole-suite run ofmaine1d84b7on this machine too. SKIPPED: the six per-lane cases off16_programs_on_the_gpu/f32_programs_on_the_gpu(refused),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Regression run
scripts/smoke.ps1, 60 s, release builds, the same title on the same day.main:
PR:
Not tested
XCL_CAPTURE_MAX_MB.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T19:27:29Z.
Independent AMD RDNA4 (native wave64) test report on exact head
20059ab65622734ccf48be4edc99aa8633caca29(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1271 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All 8hle::d3d12x::capturetests (includingcapture::textures::tests::a_copy_holds_every_subresource_and_plane) passed.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release; default capture off)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
XCL_CAPTURE_DRAWcapture on the retail title; D3D12 debug layer; Intel GPUs.AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T19:46:19Z.
gpu_suite (cold cache): 160 passed / 4 failed, no crashes. Three are the known baseline trio on this lane; the fourth isgpu_promoted_uav_clear_values_pass_create_committed_resource, newly red on main since #2280 (report), unrelated to this PR.Targeted run of the capture tests: 8 passed.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:04:33Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.Thanks!
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:53:04Z.
Review: COMMENTED
Blocked by the P1 per-subresource state flaw introduced in #2430. state_of records one state per resource, then textures::snapshot transitions ALL_SUBRESOURCES through COPY_SOURCE and back using that one StateBefore. A valid partial mip/slice transition can thus make capture declare wrong states for every other subresource, causing debug-layer errors/undefined GPU state when enabled. Track per-subresource states or skip textures with unknown partial state; add a partial-state capture test. Other copy lifetime/queue ordering looked sound, but this stacked PR also lacks a clean suite/current broad validation.
Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-25T23:43:43Z.
Thanks, fixed, with #2430's per-subresource tracking.
copy_allno longer copies a texture whose subresources are not in one known state (copyable). It goes intoleft_outwith the reason, sosnapshotnever issues anALL_SUBRESOURCEStransition from a state some subresource is not in.a_texture_in_no_one_state_is_not_copied.Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T23:59:13Z.
NVIDIA test report for
c01c55b(this branch contains #2430's headf6354cd): RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(thehle::xaudio2tests hang on this machine, onmaintoo):c01c55b: 1301 passed, 0 failed, 26 ignored.mainat08db802: 1295 passed, 0 failed, 27 ignored.SKIPPEDlines on both sides (no wave64 etc.).Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:12:31Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T17:43:21Z.
NVIDIA re-run for
5f8eb9c(onmaine1d84b7; this branch contains #2430): RTX 3070 8 GB (Ampere, driver 616.56), Windows 11, debug. Earlier I ranc01c55b(1301 passed).cargo test -p xcl --lib capture -- --test-threads=4, 3 runs: 13 passed, 0 failed, 0 skipped each, including the newa_call_that_never_reaches_the_capture_does_not_stand_for_the_next.Whole lib (
--skip hle::xaudio2 --test-threads=4): 1302 passed, 0 failed, 26 ignored. SKIPPED: 21 no wave64, 3 per-lane forms the translator refuses, 1 needs Developer Mode.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Imported from ivall/xcl. Originally posted by a-DuckGod on 2026-11-26T18:29:32Z.
Independent Windows 11 / NVIDIA test report on exact PR head
5f8eb9cd7a5702fc5bc9a5c0cdf0339b2a06980e(clean detached checkout; merge-basee1d84b7d; stacked on #2430).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc), Windows SDK DXC1.8.2502.11, D3D12 debug layer installed, debug build.cargo build --workspace: succeeded.cargo test -p xcl --lib hle::d3d12x::capture -- --nocapture: 13 passed, 0 failed, 0 ignored, 0 skipped — includinga_texture_in_no_one_state_is_not_copiedand GPU testa_copy_holds_every_subresource_and_plane.cargo test --workspace --no-fail-fast -- --test-threads=4: 1436 passed, 0 failed, 46 ignored (including alle2etests under the D3D12 debug layer and DRED).SKIPPEDGPU tests (26): 21no wave64(RTX 3080 Ti is 32-lane waves only), 3 per-lane #1426 refused forms (V_MUL_F16,V_PK_MUL_F16,V_CVT_F16_F32), 1shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache; Windows Developer Mode required), 1heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Not tested
scripts/smoke.ps1run,XCL_SAMPLE_*tests, liveXCL_CAPTURE_DRAWcapture/replay on a game, AMD / Intel / native wave64 GPUs.AI use
5f8eb9cd, ran the build and tests, and drafted this report. I checked it before posting.Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-26T20:10:10Z.
Independent test and smoke report for head
5f8eb9cd7a5702fc5bc9a5c0cdf0339b2a06980eon an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- capture --test-threads=4: 13 passed, 0 failed, 0 ignored (0skipped).Not tested: full workspace suite, 60 s smoke run on this head, NVIDIA/Intel GPUs, or Linux/Wine.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T02:14:03Z.
Independent desktop NVIDIA verification of PR #2431 at head
5f8eb9cd7a5702fc5bc9a5c0cdf0339b2a06980e(3stacked commits69e0883d -> 3d496a17 -> 5f8eb9cd, stacked with#2430; exact merge-base:e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
5f8eb9cd)cargo test --release -p xcl --lib a_texture_in_no_one_state_is_not_copied -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1336 filtered out× 3 (0.00s× 3,0skipped)cargo test --release -p xcl --lib a_copy_holds_every_subresource_and_plane -- --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1336 filtered out× 3 (0.20s,0.17s,0.17s,0skipped — live D3D12 readback copy on RTX 4060)cargo test --release -p xcl --lib hle::d3d12x::capture:: -- --test-threads=1(3 consecutive runs)13 passed; 0 failed; 0 ignored; 1324 filtered out× 3 (0.17s× 3,0skipped)cargo build --release -p xcl1m 13s, exit0,0new warnings)Paired quiet 60 s retail smoke (
title: 29640639)Exact merge-base (
e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):PR #2431 (
5f8eb9cd7a5702fc5bc9a5c0cdf0339b2a06980e, default —XCL_CAPTURE_DRAWunset):Runtime log observations (
xcl.log)9219log lines,0[ERROR]/ device-removal / panic lines.19462 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14016 MB committed by the process; video memory 6115 MB local, 4683 MB non-local.Limits of coverage
a_copy_holds_every_subresource_and_plane), non-uniform state refusal (a_texture_in_no_one_state_is_not_copied), and the full capture test suite (hle::d3d12x::capture::,13/13× 3) passed live on desktop D3D12 / RTX 4060 with0skips.XCL_CAPTURE_DRAWunset to confirm zero default-path overhead/regression acrosstitle: 29640639(frame-count and commit deltas vs. cached merge-base reflect single-run startup variance, not this PR); an end-to-endXCL_CAPTURE_DRAW=...disk capture during retail gameplay was not run here.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T22:02:03Z.
merge-check
base:
2c717a043c(main)head:
5f8eb9cd7amerge: clean, uncommitted trial merge; the diff also contains open parent #2430
build:
cargo build --workspace --locked-> oktests:
cargo test --workspace --locked --no-fail-fast -- --test-threads=4-> 1,478 passed, 1 failed, 47 ignored; 25 GPUSKIPPEDnotices. The only failure,console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, also failed on the same machine and command at cleanmain2c717a04(1,465 passed, 1 failed, 47 ignored, 25 skips). The merged branch's 13 capture tests passed. A test-onlyunproven_state_is_not_used_as_a_copy_sourceregression on this head failed 0/1 as described below.review: Not ready on the opt-in capture path:
after_executeremoves and dropsPending.snapsafter the first submit, but the closed list still recordsCopyResourceto those snapshots. D3D12 permits submitting a completed list again and does not retain its recorded resources. A second submit before Reset can use a destroyed destination; a surviving destination would also need to return fromCOPY_SOURCEtoCOPY_DESTafter the private readback. Keep recording-scoped snapshot ownership until Reset/release and retirement of its last submit. Discard a never-submitted capture when Reset replaces its recording; currentlylist_resetclears only state tracking. Add a debug-layer regression that submits the same captured list twice without Reset and another that resets it before first submission.read_backsubmits private work before creating its completion fence. Fence creation/signaling failure or the 30 s timeout returns and drops the allocator, readback buffers and snapshots while GPU work may still reference them. Earlier errors after the title submit have the same snapshot-lifetime problem. Create the fence before submission and retain submitted owners in a retirement record until observed completion or confirmed device removal, including error/timeout paths. Test a queue held behind a signal and released after the readback timeout.state_ofguessesNON_PIXEL|PIXEL_SHADER_RESOURCEwhen no transition was seen,copyableaccepts that guess, andsnapshotwrites it asStateBefore. A texture created inNON_PIXEL_SHADER_RESOURCEand read by a compute dispatch without a local transition is a concrete mismatch. The focused test below fails on this head. Copy only when the state is proven for every subresource and legal on that list; put unprovable textures inleft_out. Add a compute-list debug-layer case and a split-barrier case. I did not run those GPU cases.Focused test-only regression for finding 3 (fails on this head)
cargo test -p xcl --lib unproven_state_is_not_used_as_a_copy_source --locked -- --nocapture-> 0 passed, 1 failed, 0 ignored. The test-only edit was removed after the run.performance: Capture is opt-in; its synchronous GPU readback and up-to-2 GiB capture budget affect enabled captures. The default path's frame time was not measured here. Fixing lifetime requires bounded retirement so repeated captures do not retain GPU memory indefinitely.
verdict: not yet: repair resource ownership/state proof, add the GPU regressions, and merge #2430 first so this PR contains only its top commit.
hardware / tool and model: Windows 11 build 26300; RTX 3080 Ti 12 GB, NVIDIA 621.35; Ryzen 7 9800X3D; Rust 1.99.1 MSVC; DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the paired suites, inspected the diff, reproduced the test-only failure and wrote this report; Codex (GPT-6.2 Astra) independently traced the GPU lifetime and state paths.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:03:18Z.
Triage (#1607) – head
5f8eb9cThis PR is stacked on #2430 (and #2429); only the top commit belongs here, and it shares lines with #2432-#2435 only because they are the same stack. No other PR copies a captured call's textures.
No problems found in
capture/textures.rs. The copy is recorded on the title's list with transitions to and fromCOPY_SOURCE. The read-back runs on XCL's own queue after a fence wait on the title's queue. Textures in mixed states and multisampled textures are left out and listed.This PR conflicts with main because of the
capture.rsclash withXCL_CAPTURE_FRAME(see #2429).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.