D3D12.X: XCL_DUMP_TARGETS dumps the most-drawn render targets of a frame #2050
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!2050
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2050"
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?
@grahamster2 on GitHub · 2026-11-25 02:01 UTC · original
grahamster2:xcl-dump-targets→main· +447 −1 · 7 files · 1 commits · openAdds
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 (a draw skipped because its pipeline is a two-pass mesh pipeline counts as skipped);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=4ondb4cadc(base6567c5f): 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.db4cadcwithXCL_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.Rebased onto main
b49be18(head6123c11):cargo test -p xcl --libpasses on this head (1316 passed, 0 failed, 27 ignored). The Regression run (xcl-smoke) blocks below are from the previous head (4ad01d9against main0829441) and will be redone on this head before review. The workspace test run and the retail-title run above were done ondb4cadcand are not repeated.Regression run
main (
0829441):PR (
4ad01d9):Not tested
AI use
@raylitebull on GitHub · 2026-11-25 02:04 UTC · original
Code review on
db4cadc:crates/xcl/src/hle/d3d12x/targets.rs+ hooks inbind.rs,list_x.rs,present.rs, andreal.rsare cleanly scoped behindXCL_DUMP_TARGETS: targets are tracked by raw address withoutAddRefing (present::view_resourceverifies a live view before copying), depth buffers are counted without issuing invalid state-unknown copies, andcensusbounds buffer slices cleanly (the_census_stops_at_the_end_of_the_buffer).PR descriptionis green andBuild and test (Windows, no GPU)is currently running.Remaining before merge:
Build and testfinishing green plus AMD and NVIDIA verification ondb4cadc.@JJAutoCompare on GitHub · 2026-11-25 02:38 UTC · original
PR #2050 — XCL_DUMP_TARGETS on Intel Arc
Verified exact head
db4cadca8eba92e0d663760e5eefc486fd7547a0in a clean detached checkout.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,
DoublePrecisionFloatShaderOps=0. DXC/DXIL 1.9.2609.5.rustc 1.100.0 (0ef1bc386 2026-11-09). Dev and test profiles with debug info and incremental compilation disabled. Cargo target and temporary files were directed to L:.Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the GPU lock.cargo test -p xcl --lib hle::d3d12x::targets::tests -- --nocapturereported 7 passed, 0 failed, 0 ignored, 973 filtered out, and 0 skip markers. The tests cover option parsing, frame eligibility, draw outcomes, depth selection, target ranking and tie order, texel sizing, and census bounds and counts.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the shared Arc lock usingL:/XclTooling/Invoke-ArcTest.ps1. Cargo exited 101. The combined log isL:\XclTooling\sol-slot-7\tmp\pr2050-suite.log.The suite reported 0 measured and 0 filtered out. The log contains exactly 23
SKIPPEDlines across 13 test names. The library emitted 18 for unavailable wave64, 3 for refused wave32 per-lane lowerings, and 1 for unavailable driver-cache control (0x887A002D).gpu_compute_e2eemitted 1 for unavailable heap windows. The table gives raw libtest counts. Skip markers can describe individual cases within a test or early returns counted as passes, and confer no coverage. Libtest captured successful test output, including the debug-layer tests' skip diagnostics, so the count covers the markers visible in this log.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 (
gpu_direct_f32_round_preserved_denormal_times_inf_is_inf) is already present in the PR's parent and fails in the direct DXIL compute runner. This was a PR-head run only.21 shader tests failed at
CreateComputePipelineStatewith0x80070057.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3gpu::dxil::ops_tests::doubles_match_cpugpu::dxil::ops_tests::groupshared_barrier_and_atomics_rungpu::dxil::round_tests::gpu_direct_f32_round_modes_dynamic_and_denormalsgpu::dxil::round_tests::gpu_direct_f32_round_modes_staticgpu::dxil::round_tests::gpu_direct_f32_round_preserved_denormal_times_inf_is_infgpu::recomp::lower_dxil::tests::f64_programs_on_the_gpugpu::recomp::tests::gpu_clamp_and_omod_per_instructiongpu::recomp::tests::gpu_f64_class_comparegpu::recomp::tests::gpu_f64_compares_with_nangpu::recomp::tests::gpu_f64_literal_high_wordgpu::recomp::tests::gpu_f64_math_randomgpu::recomp::tests::gpu_f64_rootsgpu::recomp::tests::gpu_f64_rounding_and_conversionsgpu::recomp::tests::gpu_float_compares_randomgpu::recomp::tests::gpu_frexp_f64_exp_and_mantgpu::recomp::tests::gpu_ldexp_f64gpu::recomp::tests::gpu_rndne_f64Four shader tests failed assertions.
gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction(fused FMA overflow control)gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips(implicit-LOD pixel value)gpu::recomp::tests::gpu_valu_16_and_64_bit(preserving the high half of v_add_f16)gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions(pixel-shader wave reductions)The integration test
test_title_runs_and_game_folder_is_untouchedfailed the existing dynamic depth-bias check.RSSetDepthBiasX(-1000.5)produced a blue top-right pixel where the test expected green.Not tested
XCL_DUMP_TARGETSGPU readback and BMP output with the switch enabled.d3d12SDKLayers.dllis absent on this host.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
pr2050-suite.logand published this report.@JoaoPauluu on GitHub · 2026-11-25 02:50 UTC · original
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
x86_64-pc-windows-gnu.db4cadcas it is (based on6567c5f), no uncommitted changes. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input.hle::d3d12x::targets::testspass under Wine, one test per process.XCL_DUMP_TARGETS=10,2 XCL_DUMP_AFTER_S=20:exit: 0x0, 1384 frames, no device removal, no crash. Two frames were dumped at 46.2 s:not dumped: its state is not known). All drawsran, none stand-in, PC or skipped.ran.518400 of 518400 texels sampled not zero, 0 differ from the first texel, all0xff2c2020. The 7 BMPs were written to the title'slogsfolder.XCL_DUMP_TARGETS="10,2:XCL_DUMP_AFTER_S=20"(my script's mistake). That gaveis not <draws and dispatches>[,<frames>]: no targets dumpedand the run went on normally, so the bad-value path warns as intended.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
<work>threshold, the whole suite on this head, native Windows.AI use
@Alm0stSurely on GitHub · 2026-11-25 02:25 UTC · original · edited 2026-11-25 04:06 UTC
Linux/Proton world-loading result for the target census. I applied the unmodified diff of
db4cadca8eba92e0d663760e5eefc486fd7547a0to the previously measured baselinec00f3fcfce59bb4dfd3a1f96bbc84c60e765b538and built release. EndeavourOS, Proton Experimental, Ryzen 9 9950X3D, RTX 5080, NVIDIA 620.73.04. Launch inside the isolated test environment:proton run /build/xcl.exe run <title-exe>. Main settings:XCL_DUMP_TARGETS=100,3 XCL_DUMP_AFTER_S=215 XCL_FRAME_DUMP=120 XCL_DIRECT_DXIL=0 XCL_COMPACT_CS=auto XCL_PSO_PRELOAD=0 XCL_PSO_WAIT_MS=250 XCL_ACTIVITY=1 XCL_RUN_SECONDS=300 XCL_NETWORK=0, warm cache copied independently per attempt.Frames 1607, 1608 and 1609 (221.0–223.9 s) each listed 40 color targets. Their presented readbacks contained exactly one RGBA8 value,
0x553a3432, at all 518400 sampled texels. Of the top eight color targets, seven had zero raw values at every sampled position in each frame. The exception was the same 2560×1440 R16G16_FLOAT resource, ranked second or third: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
c00f3fcfplus the target-dump change atdb4cadca), I compared independent copies of the same warm cache. WithXCL_PSO_PRELOAD=0, the R32_UINT target recorded 180/180/360 stand-in draws on frames 1663–1665. All three frames used the same 180 pipeline instances (3 distinct VS, 180 distinct PS). On first observed stand-in use, each instance still had its build job available. The corresponding integer attachment was slot 1 with blending and logic ops disabled.With
XCL_PSO_PRELOAD=1and only those 180 shader-set keys in the initial pipeline history, frames 1681–1683 recorded 48/180, 49/180, 49/180 translated draws on that target. At readback, every one of the 230,400 sampled R32_UINT texels was still zero in each frame. Each corresponding 960×540 presentation was uniform (raw0x553a3432). This pair shows that readiness can change substantially while the measured output stays empty. The next useful distinction is whether one translated draw actually writes the integer attachment before later clears or passes. Both runs usedXCL_DIRECT_DXIL=0 XCL_PSO_WAIT_MS=250 XCL_DUMP_AFTER_S=215 XCL_DUMP_TARGETS=100,3. One run per condition. Local instrumentation and analysis assisted by Codex (GPT-6.2 Astra).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
SV_Target1at register 1, including the 49 candidate keys inferred by subtracting the stand-ins on frame 1682. The sole instance that disappeared from the stand-in set between frames 1681 and 1682 finished compiling between those captures (PS1acd1e3b68d87382). Its cached DXIL contains an integerstoreOutputto element 1, component 0. A runtime condition selects a computed value or zero. This rules out a missing red-channel export in that binary. The effective RT1 write mask, runtime value and direct identity of the translated draw remain unmeasured.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
IndependentBlendEnable=FALSEand effectiveRenderTarget[0].RenderTargetWriteMask=0xFin the descriptor passed to D3D12. Red writes were enabled. All 230,400 sampled texels remained zero per frame and the matching presentations were uniform gray. This narrows the next measurement to fragment coverage and the contents immediately after an individual translated draw.Per-draw GPU statistics. On the same setup, a D3D12 pipeline-statistics query bracketed each of three native
ExecuteIndirectcalls with the same translated graphics pipeline (PS00771d5dd90bf78c, shader-set key0c84540f681d8977), R32_UINT bound at slot 1,MaxCommandCount=1, no count buffer. The three recordings were submitted once each. After recording retirement and queue-fence completion, all three queries returned 0 IA vertices, 0 IA primitives, 0 VS invocations, 0 clipper invocations/output primitives and 0 PS invocations. Later frames 1625–1627 still recorded 48 translated calls on this target per frame. For this one pipeline, marking a call as translated did not mean it produced geometry. A second isolated run reproduced all-zero IA/VS/PS counts for three more calls on this pipeline. All three signatures contained onlyDRAW(non-indexed), stride 16, native argument-buffer offset 16, placement delta 0. XCL tracked no active predicate on those command lists. In a follow-up with an instrumented vkd3d-proton4522cc1, the driver recordedvkCmdDrawIndirecton each of three calls. Immediately before each draw, the same command buffer copied its actual 16-byteVkDrawIndirectCommandfrom the native argument buffer atmem.offset + 16. All three records were{vertexCount=0, instanceCount=0, firstVertex=0, firstInstance=0}. A separate 16-byte positive transfer control returned[3,1,7,11]each time. The destinations were initialized with sentinels and read after queue-fence completion. IA/VS/PS counts were again zero. This explains those three empty draws on this pipeline. Some indirect records can legitimately be empty, and the diagnostic adds transfer barriers that can affect timing. This measurement does not establish why other pipelines or the final presentation are empty.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
vkCmdDrawIndirectper key. All 47 fenced argument reads returned(0, 0, 0, 0)across 24 distinct offsets of one Vulkan buffer. All 47 corresponding pipeline queries reported zero input vertices and zero vertex/pixel shader invocations. This narrows the next trace to the commands that populate those offsets and their ordering before consumption. It does not establish why the records are empty or whether these draws are required for the scene.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
CopyBufferRegioncommands overlapped the sampled bytes. The preceding 1,498,849 copies had aged out, and this probe does not cover UAV writes or different native buffer aliases. This rules out the sparse-window resource as the direct draw argument object in this capture. The producer and execution ordering remain open. A paired replay (same integration, Codex GPT-6.2 Astra) successfully read all 16 bytes at the associated title address at CPU command recording for each of the 47 draws. Across 24 offsets, every CPU tuple and every corresponding fenced GPU tuple was(0, 0, 0, 0). This gives no evidence of populated CPU draw arguments going missing in this sample. CPU recording and GPU consumption are different observation times.@DavidM1911 on GitHub · 2026-11-25 04:41 UTC · original
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!
@grahamster2 on GitHub · 2026-11-25 15:45 UTC · original
rebased onto main
0829441mod standin;andmod targets;cargo test -p xcl --lib: 1210 passed, 0 failed, 26 ignored
@DavidM1911 on GitHub · 2026-11-26 07:13 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.4ad01d94e8to6123c11702@grahamster2 on GitHub · 2026-11-26 09:07 UTC · original
rebased onto main
b49be18(head6123c11)is_pending(raw_pso)and added the STANDIN outcome hook.raw_pso || psocheck and addednote_dispatch().note_dispatch()runs after that block so a deferred dispatch is counted once, at replay.dumpsis created, before the compositor/copy block, anddueincludes the targets dump as before.cargo test -p xcl --lib: 1316 passed, 0 failed, 27 ignored.
smoke rerun pending
@thehollowedone on GitHub · 2026-11-26 13:47 UTC · original
Independent Windows/NVIDIA check of head
6123c11, based onb49be18.Windows 11 build 26300, RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, rustc 1.99.1 MSVC.
cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib hle::d3d12x::targets::tests -- --test-threads=4: 7 passed, 0 failed, 0 ignored.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,442 passed, 0 failed, 47 ignored across 37 test targets. The passed count includes 25 explicit GPU skip notices: 21 no wave64, 3 refused per-lane cases, and 1 no heap windows.This checks the diagnostic's synthetic tests and the current-head workspace suite. I did not run the switch on a title, check render targets left in other D3D12 states, run AMD hardware, or produce the paired
xcl-smokeblocks required for the runtime change. The PR's existing smoke blocks name earlier commits.AI use: Codex (GPT-6.2 Sol) inspected the current revision, selected and ran the tests, and drafted this report.
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.