D3D12.X: the capture format of one draw or dispatch #2419
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2429"
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:37:49Z.
A GPU hang in a retail title costs a whole game run per experiment. This stack writes one draw or dispatch of a named shader to disk during a run (
XCL_CAPTURE_DRAW) and runs it again alone, in seconds (xcl replay). Part of #675.This first part is the format of a capture only; nothing writes one yet.
What is in it
hle/d3d12x/capture/manifest.rs: themanifest.jsonof a capture folder (the call, shader files, the PC pipeline description, root arguments, fixed-function state, targets, memory ranges, textures, views, samplers, descriptor slots, what was left out),Manifest::write/Manifest::readwith a version check. D3D12 structures are kept as hex of their bytes.hle/d3d12x/capture.rs,mod.rs: the module.unhexrefuses an odd number of digits or non-hex text;Manifest::readchecks every hex field, that D3D12 structures have this build's size, that root arguments are whole dwords, and that every file it names is a plain name in the capture folder (plain_name). Tests:a_damaged_manifest_is_refused,plain_names_only.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on69e0883: 1423 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; both fail 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
windowscrate structure layouts (the manifest keeps their bytes).AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T19:46:17Z.
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 new capture-format tests (manifest round-trip, version refusal, subresource/plane copy, texture-state list, hex round-trip): 3 passed.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T19:54:37Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (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:51:19Z.
Review: COMMENTED
P2 capture-integrity issue: unhex silently drops malformed pairs/odd nibbles (manifest.rs:229-231; tests explicitly accept "zz10" and "0fa"), and Manifest::read validates only JSON/version. Corrupt descriptors become None/default views, while padded malformed PSO blobs can still be consumed as shifted raw structures. A diagnostic capture can silently replay a different pipeline/view. Make unhex return Result and reject odd/non-hex input; validate fixed-size hex fields on read and add malformed-capture rejection tests. Current Windows check also fails.
Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-25T23:43:32Z.
Thanks, fixed in the force-pushed commit:
unhexnow returnsResult: an odd number of digits, or anything but hex digits (signs included), is an error that names the digit.Manifest::readchecks every hex field after the version check:memory.bin,tex_<id>.bin) must be one plain name inside the capture folder (plain_name).hex_round_tripsnow expects the errors;a_damaged_manifest_is_refusedcovers odd and non-hex fields, wrong-size structures, partial root dwords and paths out of the folder;plain_names_onlycovers the name check.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:12:33Z.
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 Foniass on 2026-12-01T08:02:46Z.
Triage (#1607) – head
69e0883This is the base of the stack #2429-#2435, all by the same author; the shared lines across those PRs are the stack, not duplicates. No other open or merged PR adds a single-draw capture format or
xcl replay.The conflict comes from main:
b85c3161(XCL_CAPTURE_FRAME, one frame's command stream) added a privatemod capture;andhle/d3d12x/capture.rsafter this PR's base, so the newpub mod captureandcapture/manifest.rsclash with it. The stack needs to be rebased under another module name, or merged into that module.No problems found in the manifest code. Only
samplershas#[serde(default)], so the claim that older manifests still read covers that one field only.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.