Repository navigation
D3D12.X: XCL_DUMP_TARGETS dumps the most-drawn render targets of a frame - #2050
grahamster2 wants to merge 1 commit into
Conversation
A black presented frame does not say whether the scene was drawn and the composite lost, or the scene never drawn at all; nor which of the draws that should have made it actually ran. XCL_FRAME_DUMP shows only the presented image. XCL_DUMP_TARGETS=<work>[,<frames>]: in the first <frames> frames (default 1) with at least <work> draws and dispatches, each render target drawn into, and the depth buffer drawn with most, is logged with its address, size, format and its draws split into ran (translated pipeline), stand-in (pipeline still being built: draws nothing), PC (untranslated) and skipped. The eight drawn into most are read back with the presented frame and written next to it (target<k>_<n>.bmp), with how many of their sampled texels are not zero and how many differ from the first one (a cleared target has none that differ). The census reads by the footprint's texel size and stops at the end of the readback buffer. The depth buffer is not copied: XCL does not know the state the title left it in, and a copy from DEPTH_WRITE is invalid. A frame counts as dumped once its copies are submitted; one waiting for a present that copies is kept. XCL_DUMP_AFTER_S=<s>: no frame is dumped until <s> seconds (fractions too) after the first present (a title's menus are busy frames too). Invalid values of either switch are logged once. Off by default: every hook returns on a cached check of the switch, and DSVs are only recorded with it set, so nothing is locked or allocated without it. Assisted-by: Claude Code (Claude Opus 5.5)
|
Code review on
Remaining before merge: |
|
Linux/Proton world-loading result for the target census. I applied the unmodified diff of Frames 1607, 1608 and 1609 (221.0–223.9 s) each listed 40 color targets. Their presented readbacks contained exactly one RGBA8 value,
The tested RGBA8 UNORM and sRGB targets each counted 221/221/220 translated draws across those frames, yet every sampled texel was zero. The R32_UINT target counted 360/180/180 stand-ins and zero translated draws. These counts are per bound target at recording time; MRT counts can overlap. Depth was listed only. The R16G16_FLOAT BMP is marked “format not decoded”, so the raw census is essential here. Pixel variation in this two-channel target alone does not establish a composed scene. The measured run reached the 300 s cap with 1633 PresentX calls and no logged device removal before the cap. An earlier attempt lost the device at 37.572 s before any target dump. This supplements the author's menu case with paired readbacks from a flat presented frame on Proton. Full-suite testing on the PR's standalone head was outside this run. Test and report assisted by Codex (GPT-6.2 Astra). Targeted preload comparison on Linux/Proton. On the same instrumented binary (base c00f3fc plus the target-dump change at db4cadc), I compared independent copies of the same warm cache. With With Pixel-shader output check on the same run. 52 of the 180 selected pixel shaders had a translated cache entry available for inspection. All 52 declare a UINT Effective color write mask. A follow-up on the same instrumented base and selected-key cache setup joined translated draws to their compiled graphics PSO and bound attachment slot. Frames 1676–1678 each recorded 48 translated draws and 132 stand-ins on the R32_UINT attachment. All 48 translated draws per frame bound the target at slot 1 with Per-draw GPU statistics. On the same setup, a D3D12 pipeline-statistics query bracketed each of three native Follow-up on the same instrumented integration (Codex, GPT-6.2 Astra). In a single CPU recording interval between presents, we sampled the other 47 translated graphics pipeline keys on the same R32 target, one native Allocation check on a second replay of the same cohort (Codex, GPT-6.2 Astra): all 47 draws used one 1,920-byte committed DEFAULT-heap buffer with ALLOW_UNORDERED_ACCESS. XCL tracked a separate title address outside its UMA windows for the sampled offsets. None of the most recent 262,144 recorded |
PR #2050 — XCL_DUMP_TARGETS on Intel ArcVerified exact head Environment STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175, wave sizes 8–32, Tested
The suite reported 0 measured and 0 filtered out. The log contains exactly 23 Failures The 26 failures appear unrelated to the dump logic based on the failing paths and the earlier same-host PR #1924 log. That log records 25 of the same names, including the identical depth-bias failure. The remaining test ( 21 shader tests failed at
Four shader tests failed assertions.
The integration test Not tested
AI use T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against |
|
A run of the switch under Wine on Linux, where this title's picture is a flat dark colour: the dump works and says what the picture already suggested. The few draws in the dumped frames all ran, and every target they drew into holds a single colour. Tested
The dumped frames are light ones (12 and 27 draws) about 46 s in. In 60 s with no input this title does not get past that, so this does not show the busy frames. Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Adds
XCL_DUMP_TARGETS=<work>[,<frames>], an opt-in diagnostic for black-screen cases. A busy frame (at least<work>draws and dispatches) gets a table of every render target drawn into and the depth buffer: format, size, and the draws into each, split into ran / stand-in (pipeline still being built) / PC / skipped. The 8 most-drawn targets are copied back and written as BMPs next to the presented frame, with a texel census ("N of M texels sampled not zero, K differ from the first texel"). That tells a lost composite (targets drawn, frame black) from a scene that never ran (draws all stand-ins, targets still at their clear value).XCL_DUMP_AFTER_S=<s>holds the dumps until s seconds after the first present, so the frames you get are the world, not the menus. Off by default: every hook returns on a cached check when the variable is unset.Related: #1295 fixes how
XCL_TRACE_FRAMEpicks the single busiest live render target for its one intermediate dump (it keeps a reference so a replaced RTV isn't read). This PR is separate: it counts per-target draw outcomes for a whole frame and dumps the top 8 plus the depth row. It reuses main'sreadback_copy/write_frame/ RTV map, and does not touch the selection #1295 changes. The two can merge in either order; if #1295 lands first,view_resourcehere could use its live-RTV registry.What is in it
crates/xcl/src/hle/d3d12x/targets.rs: switch parsing, per-frame target and outcome counting, ranking, texel census, the table; unit tests.bind.rs/list_x.rs: one hook per draw, dispatch and ExecuteIndirect path with its outcome;bound_render_targets.present.rs: copies the picked targets at the present, logs the census, counts a frame as dumped only once its readback is submitted.real.rs: DSVs go into the view map only when the switch is set.README.md: the two variables.Limits (also in the module doc): draws are attributed to frames by recording time. The depth buffer is listed but not copied, because XCL doesn't track the title's resource states. Colour targets are copied in whatever state the title left them, as
XCL_TRACE_FRAMEalready does. MSAA and non-2D targets are listed as "not dumped". ExecuteIndirect counts once whatever its count.Size: +444/-1, of which 104 lines are the test module.
Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on db4cadc (base 6567c5f): 1004 passed, 0 failed, 45 ignored. 23 SKIPPED lines: 22no wave64/refusedin gpu::recomp, plusheap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.XCL_DUMP_TARGETS=10,2 XCL_DUMP_AFTER_S=20on a retail title (60 s, menus): two frames were dumped at 29.8 s (frames 736 and 737). For each, the table listed 2-3 render targets (3840x2160, format 28, all draws ran) and the depth buffer as "not dumped: its state is not known". The BMPs were written, and the census read 518400 of 518400 texels not zero, 284148 differ from the first texel. On that menu screen the targets and the presented frame are the same picture (identical BMPs). The run exited normally.Regression run
main:
PR:
Not tested
AI use