D3D12.X: XCL_CAPTURE_DRAW writes one draw or dispatch to disk #2420

Open
madaraXor wants to merge 2 commits from upstream-pr/2430 into main
madaraXor commented 2026-11-25 18:37:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-25T18:37:56Z.


XCL_CAPTURE_DRAW=<container fnv64, hex>[:N] writes the Nth draw or dispatch whose VS, PS or CS is that console shader to <data>\captures\: everything needed to run it again alone except the textures' contents, which the next PR adds. Off unless the variable is set. Part of #675.

The matching calls are not run in that run (XCL_CAPTURE_RUN=1 runs them): the switch is for a call that hangs the GPU. XCL_CAPTURE_DRAW=list only logs each translated pipeline's shader hashes, to find the hash to give.

Over 400 lines: the hook is one piece. The notes it needs (the view at each heap index, the last transition of a resource) are of no use without the call that reads them, and the call cannot be written without them.

Stacked on #2429; only the top commit belongs here.

What is in it

  • hle/d3d12x/capture.rs: the switch; what is noted while it is set (pipelines with the chosen shader, the SRV / UAV made at each heap index, RTV / DSV by handle, samplers, the last transition of a resource; a view counts only if its resource was not released since); on_call (shader containers, PC pipeline description, root arguments and the io words, fixed-function state, targets, vertex / index buffer views, the non-zero slots of each descriptor table, textures with their descriptions and views); memory read on the CPU at the submit of the call's list (titles fill buffers after recording the call); the pipeline listing.
  • bind.rs: the call's arguments, and the capture at the end of bind_abi, where the io words and the argument table exist.
  • real.rs, console_heap.rs, list_x.rs, dred.rs: one-line notes at pipeline, view, sampler and target-view creation, descriptor copies, transitions, resource release, before and after ExecuteCommandLists; list_x::capture_state.
  • Tests: view liveness after a release, the order a texture's state is taken from, root argument words.
  • Review fixes: transition states are kept per subresource (ResState: one state for all of them, then those transitioned on their own); a texture gets one state only when all its subresources (planes included) are in it, else state_source says partial: and why. Test: a_partial_transition_leaves_the_texture_state_unknown. The call being bound lives for one entry point (CallScope): a draw that never reaches bind_abi (an untranslated pipeline) no longer leaves its Call for a later DrawIndexedX, which now sets its own. Test: a_call_that_never_reaches_the_capture_does_not_stand_for_the_next.

Tested

  • AMD Radeon RX 6700 XT 12 GB (RDNA2), driver 32.0.21045; Ryzen 5 5600X, 16 GB; Windows 10 22H2 (19045); rustc 1.90.0; release
  • A retail title, top of the stack (on the head before the review fixes): XCL_CAPTURE_DRAW=list in its menus listed 8 pipelines (5 VS + PS, 3 CS); two draws were then captured by hash (:3, a DrawIndexed of 30 with 4 textures; :100, a Draw of 3) and replayed.
  • Earlier, from a local branch with the same hook: the draw of a volumetric light pass that hangs the GPU was captured (DrawIndexed 72 x 6003, 86 memory ranges, 156 textures, nothing left out).
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 3d496a1: 1429 passed, 5 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 tests test_title_runs_and_game_folder_is_untouched, test_title_draws_with_a_root_signature_under_the_debug_layer and test_title_runs_under_the_debug_layer_with_dred, which fail on main e1d84b7 on this machine too (its whole suite: 1416 passed, 7 failed, 46 ignored). SKIPPED: the six per-lane cases of f16_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:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: AMD Radeon RX 6700 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 788 (PresentX 788)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15646 MB

PR:

xcl-smoke v1
commit: 3d496a1723f81856a3d445f27412c1ba6707c756
gpu: AMD Radeon RX 6700 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 928 (PresentX 928)
presents per 2 s (last 3): 54 54 60
device removals: 0
crashes: 0
peak commit: 16495 MB

Not tested

  • ExecuteIndirect (its arguments are not captured), console geometry and mesh pipelines and compute pipelines split into a dispatch chain (listed, not captured), memory reached through a pointer kept in a buffer (XCL_CAPTURE_EXTRA).
  • Dispatch captures in a title (only draws were captured).
  • Titles whose view heaps are not in the shared heap; several sampler heaps (one index space is assumed).
  • NVIDIA, Intel, RDNA3 / RDNA4; Windows 11.

AI use

  • Claude Code. Claude Fable 5.2 wrote the code, the tests and this description, and ran the tests listed above. Claude Opus 5.5 coordinated the work and ran the game checks. Claude Opus 5.5 wrote the review fixes of the last push and their tests, and ran the suites and smoke runs of this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5497040334 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430). Originally posted by [madaraXor](https://github.com/madaraXor) on 2026-11-25T18:37:56Z. --- `XCL_CAPTURE_DRAW=<container fnv64, hex>[:N]` writes the Nth draw or dispatch whose VS, PS or CS is that console shader to `<data>\captures\`: everything needed to run it again alone except the textures' contents, which the next PR adds. Off unless the variable is set. Part of #675. The matching calls are not run in that run (`XCL_CAPTURE_RUN=1` runs them): the switch is for a call that hangs the GPU. `XCL_CAPTURE_DRAW=list` only logs each translated pipeline's shader hashes, to find the hash to give. Over 400 lines: the hook is one piece. The notes it needs (the view at each heap index, the last transition of a resource) are of no use without the call that reads them, and the call cannot be written without them. Stacked on #2429; only the top commit belongs here. **What is in it** - `hle/d3d12x/capture.rs`: the switch; what is noted while it is set (pipelines with the chosen shader, the SRV / UAV made at each heap index, RTV / DSV by handle, samplers, the last transition of a resource; a view counts only if its resource was not released since); `on_call` (shader containers, PC pipeline description, root arguments and the `io` words, fixed-function state, targets, vertex / index buffer views, the non-zero slots of each descriptor table, textures with their descriptions and views); memory read on the CPU at the submit of the call's list (titles fill buffers after recording the call); the pipeline listing. - `bind.rs`: the call's arguments, and the capture at the end of `bind_abi`, where the `io` words and the argument table exist. - `real.rs`, `console_heap.rs`, `list_x.rs`, `dred.rs`: one-line notes at pipeline, view, sampler and target-view creation, descriptor copies, transitions, resource release, before and after ExecuteCommandLists; `list_x::capture_state`. - Tests: view liveness after a release, the order a texture's state is taken from, root argument words. - Review fixes: transition states are kept per subresource (`ResState`: one state for all of them, then those transitioned on their own); a texture gets one state only when all its subresources (planes included) are in it, else `state_source` says `partial:` and why. Test: `a_partial_transition_leaves_the_texture_state_unknown`. The call being bound lives for one entry point (`CallScope`): a draw that never reaches `bind_abi` (an untranslated pipeline) no longer leaves its `Call` for a later `DrawIndexedX`, which now sets its own. Test: `a_call_that_never_reaches_the_capture_does_not_stand_for_the_next`. **Tested** - AMD Radeon RX 6700 XT 12 GB (RDNA2), driver 32.0.21045; Ryzen 5 5600X, 16 GB; Windows 10 22H2 (19045); rustc 1.90.0; release - A retail title, top of the stack (on the head before the review fixes): `XCL_CAPTURE_DRAW=list` in its menus listed 8 pipelines (5 VS + PS, 3 CS); two draws were then captured by hash (`:3`, a DrawIndexed of 30 with 4 textures; `:100`, a Draw of 3) and replayed. - Earlier, from a local branch with the same hook: the draw of a volumetric light pass that hangs the GPU was captured (DrawIndexed 72 x 6003, 86 memory ranges, 156 textures, nothing left out). - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `3d496a1`: 1429 passed, 5 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 tests `test_title_runs_and_game_folder_is_untouched`, `test_title_draws_with_a_root_signature_under_the_debug_layer` and `test_title_runs_under_the_debug_layer_with_dred`, which fail on `main` `e1d84b7` on this machine too (its whole suite: 1416 passed, 7 failed, 46 ignored). SKIPPED: the six per-lane cases of `f16_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: ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: AMD Radeon RX 6700 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 788 (PresentX 788) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15646 MB ``` PR: ``` xcl-smoke v1 commit: 3d496a1723f81856a3d445f27412c1ba6707c756 gpu: AMD Radeon RX 6700 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 928 (PresentX 928) presents per 2 s (last 3): 54 54 60 device removals: 0 crashes: 0 peak commit: 16495 MB ``` **Not tested** - ExecuteIndirect (its arguments are not captured), console geometry and mesh pipelines and compute pipelines split into a dispatch chain (listed, not captured), memory reached through a pointer kept in a buffer (`XCL_CAPTURE_EXTRA`). - Dispatch captures in a title (only draws were captured). - Titles whose view heaps are not in the shared heap; several sampler heaps (one index space is assumed). - NVIDIA, Intel, RDNA3 / RDNA4; Windows 11. **AI use** - Claude Code. Claude Fable 5.2 wrote the code, the tests and this description, and ran the tests listed above. Claude Opus 5.5 coordinated the work and ran the game checks. Claude Opus 5.5 wrote the review fixes of the last push and their tests, and ran the suites and smoke runs of this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
emirduran707 commented 2026-11-25 20:08:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T19:27:31Z.


Independent AMD RDNA4 (native wave64) test report on exact head c2569b06fb949f6b5480e36f31403f98c296700b (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (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: 1270 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All 7 hle::d3d12x::capture tests passed.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release; default capture off)

xcl-smoke v1
commit: c2569b06fb949f6b5480e36f31403f98c296700b
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1598 (PresentX 1598)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14908 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • Live XCL_CAPTURE_DRAW capture on the retail title; D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7172323936 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7172323936). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-25T19:27:31Z. --- Independent AMD RDNA4 (native wave64) test report on exact head `c2569b06fb949f6b5480e36f31403f98c296700b` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`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`: **1270 passed, 2 failed, 46 ignored; 8 SKIPPED** (6 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused by per-lane form; `heap_window_out_of_memory_falls_back_to_the_switch_form`; `pso_measurement_compiles_an_exact_synthetic_record`). All 7 `hle::d3d12x::capture` tests passed. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722 and `fuzz_validate_and_gpu_3` seed 1599) are pre-existing on unmodified `main` on this GPU. **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release; default capture off) ``` xcl-smoke v1 commit: c2569b06fb949f6b5480e36f31403f98c296700b gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1598 (PresentX 1598) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14908 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - Live `XCL_CAPTURE_DRAW` capture on the retail title; D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
DavidM1911 commented 2026-11-25 20:08:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T19:46:02Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7172738857 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7172738857). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T19:46:02Z. --- 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!
SlopTart commented 2026-11-25 20:08:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T19:46:18Z.


gpu_ suite (cold cache): 160 passed / 4 failed, no crashes. Three are the known baseline trio on this lane; the fourth is gpu_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 (XCL_CAPTURE_DRAW path): 7 passed.

<!-- greyfinch-sync:ivall/xcl:comment:7172744427 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7172744427). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T19:46:18Z. --- `gpu_` suite (cold cache): 160 passed / 4 failed, no crashes. Three are the known baseline trio on this lane; the fourth is `gpu_promoted_uav_clear_values_pass_create_committed_resource`, newly red on main since #2280 ([report](https://github.com/xcl-dev/xcl/pull/2280#issuecomment-7172066690)), unrelated to this PR. Targeted run of the capture tests (`XCL_CAPTURE_DRAW` path): 7 passed.
bmjask commented 2026-11-25 20:51:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:51:20Z.

Review: COMMENTED


P1 capture correctness: state is tracked per resource, not per subresource. note_transition records only resource + after state while the hook discards barrier subresource b[4]; Manifest likewise stores one state per texture. A valid transition of one mip/slice makes capture/replay treat every slice as that state, producing invalid transitions or incorrect inputs. Track state per subresource or omit/refuse partially transitioned resources without complete state knowledge; add a partial-mip regression. Current Windows CI fails; this is the underlying state bug also visible in later #2432.

<!-- greyfinch-sync:ivall/xcl:review:6064815113 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#pullrequestreview-6064815113). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T20:51:20Z. **Review:** COMMENTED --- P1 capture correctness: state is tracked per resource, not per subresource. note_transition records only resource + after state while the hook discards barrier subresource b[4]; Manifest likewise stores one state per texture. A valid transition of one mip/slice makes capture/replay treat every slice as that state, producing invalid transitions or incorrect inputs. Track state per subresource or omit/refuse partially transitioned resources without complete state knowledge; add a partial-mip regression. Current Windows CI fails; this is the underlying state bug also visible in later #2432.
madaraXor commented 2026-11-26 00:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-25T23:43:37Z.


Thanks, fixed in the force-pushed commit: states are tracked per subresource.

  • note_transition takes the barrier's subresource (b[4]). Per resource there is a ResState: one state for all subresources (from an ALL_SUBRESOURCES barrier) and the subresources transitioned on their own since.
  • state_of returns one state only when all of the texture's subresources are in it. The count includes planes (D3D12_FEATURE_FORMAT_INFO).
  • Otherwise the texture's state_source says partial: and why: subresources in different states, or one transitioned while the others are unknown. A use hint does not override a partial state recorded on the list.
  • Test: a_partial_transition_leaves_the_texture_state_unknown (a mip on its own, then the others one by one, then all again, and a texture with only one subresource ever transitioned).
<!-- greyfinch-sync:ivall/xcl:comment:7177963696 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7177963696). Originally posted by [madaraXor](https://github.com/madaraXor) on 2026-11-25T23:43:37Z. --- Thanks, fixed in the force-pushed commit: states are tracked per subresource. - `note_transition` takes the barrier's subresource (`b[4]`). Per resource there is a `ResState`: one state for all subresources (from an `ALL_SUBRESOURCES` barrier) and the subresources transitioned on their own since. - `state_of` returns one state only when all of the texture's subresources are in it. The count includes planes (`D3D12_FEATURE_FORMAT_INFO`). - Otherwise the texture's `state_source` says `partial:` and why: subresources in different states, or one transitioned while the others are unknown. A use hint does not override a partial state recorded on the list. - Test: `a_partial_transition_leaves_the_texture_state_unknown` (a mip on its own, then the others one by one, then all again, and a texture with only one subresource ever transitioned).
upipibi commented 2026-11-26 00:05:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-25T23:59:12Z.


NVIDIA test report for f6354cd: 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 (the hle::xaudio2 tests hang on this machine, on main too):

  • this PR f6354cd: 1299 passed, 0 failed, 26 ignored.
  • main at 08db802: 1295 passed, 0 failed, 27 ignored.
  • The same 25 SKIPPED lines on both sides (no wave64 etc.).

Lib tests only; no title run.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7178271261 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7178271261). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T23:59:12Z. --- NVIDIA test report for `f6354cd`: 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` (the `hle::xaudio2` tests hang on this machine, on `main` too): - this PR `f6354cd`: **1299 passed, 0 failed**, 26 ignored. - `main` at `08db802`: 1295 passed, 0 failed, 27 ignored. - The same 25 `SKIPPED` lines on both sides (no wave64 etc.). Lib tests only; no title run. AI-assisted (Claude Code, Claude Opus 5.5).
DavidM1911 commented 2026-11-26 03:06:29 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T02:12:32Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7180568862 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7180568862). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T02:12:32Z. --- 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
luckyteagirl commented 2026-11-26 07:51:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T07:51:42Z.

Review: COMMENTED


bind.rs:497,530 / capture.rs:353: the CALL TLS can survive a draw that does not reach bind_abi. For example, DrawInstanced with a nontranslated PC graphics PSO sets Call::Draw; graphics_bound returns its PC list without calling bind_abi (bind.rs:549–596), so nothing takes/clears CALL. On the same title thread, a later console DrawIndexedX for a translated target enters prepare_indexed_draw, whose set_call_if_unset preserves the old Draw. When this translated call reaches on_call, it captures the second call's state with the first call's type and arguments. Its manifest can then replay the wrong operation instead of the indexed draw.

Could call metadata be passed with the actual operation or overwritten/cleared for each draw that may skip capture, including the DrawIndexedX helper path? A regression can issue a nontranslated draw followed by a translated DrawIndexedX on one thread and assert that the captured Call is indexed. This is source review at exact head f6354cd4f80c583501c2a386017384631f369e80; I have not run a title capture. The stacked #2431/#2432 heads inherit this path. AI-assisted review with Codex.

<!-- greyfinch-sync:ivall/xcl:review:6070283178 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#pullrequestreview-6070283178). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T07:51:42Z. **Review:** COMMENTED --- `bind.rs:497,530` / `capture.rs:353`: the `CALL` TLS can survive a draw that does not reach `bind_abi`. For example, `DrawInstanced` with a nontranslated PC graphics PSO sets `Call::Draw`; `graphics_bound` returns its PC list without calling `bind_abi` (`bind.rs:549–596`), so nothing takes/clears `CALL`. On the same title thread, a later console `DrawIndexedX` for a translated target enters `prepare_indexed_draw`, whose `set_call_if_unset` preserves the old `Draw`. When this translated call reaches `on_call`, it captures the second call's state with the first call's type and arguments. Its manifest can then replay the wrong operation instead of the indexed draw. Could call metadata be passed with the actual operation or overwritten/cleared for each draw that may skip capture, including the `DrawIndexedX` helper path? A regression can issue a nontranslated draw followed by a translated `DrawIndexedX` on one thread and assert that the captured `Call` is indexed. This is source review at exact head `f6354cd4f80c583501c2a386017384631f369e80`; I have not run a title capture. The stacked #2431/#2432 heads inherit this path. AI-assisted review with Codex.
futurepro62 commented 2026-11-26 09:07:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-26T08:45:11Z.


NVIDIA and AMD full-suite run, to go with the reports above by upipibi, since none of them covers AMD. Tested exact head f6354cd4 (on its base e1d84b7).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1421 passed, 0 failed, 44 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, dispatch_chain_native_wave64_builds_whole, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: views_of_released_resources_are_not_live, a_texture_state_comes_from_the_list_first, a_partial_transition_leaves_the_texture_state_unknown, root_argument_words_read_past_the_end_as_zero, hex_round_trips, a_manifest_reads_back_as_written, another_version_is_refused, a_damaged_manifest_is_refused, plain_names_only, a_manifest_without_samplers_reads.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1432 passed, 0 failed, 46 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main b49be183 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests, const_and_null_mask_operands_agree_with_hlsl_on_the_gpu and mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7186975221 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7186975221). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T08:45:11Z. --- NVIDIA and AMD full-suite run, to go with the reports above by upipibi, since none of them covers AMD. Tested exact head `f6354cd4` (on its base `e1d84b7`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **1421 passed, 0 failed, 44 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `dispatch_chain_native_wave64_builds_whole`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `views_of_released_resources_are_not_live`, `a_texture_state_comes_from_the_list_first`, `a_partial_transition_leaves_the_texture_state_unknown`, `root_argument_words_read_past_the_end_as_zero`, `hex_round_trips`, `a_manifest_reads_back_as_written`, `another_version_is_refused`, `a_damaged_manifest_is_refused`, `plain_names_only`, `a_manifest_without_samplers_reads`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1432 passed, 0 failed, 46 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `b49be183` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests, `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` and `mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
madaraXor commented 2026-11-26 11:05:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-26T10:26:00Z.


Thanks, confirmed and fixed (force-pushed).

  • The call being bound now lives for one entry point. capture::call_scope sets it, and its guard clears it when the entry point returns, whether or not bind_abi took it. This covers DrawInstanced, DrawIndexedInstanced, the dispatch and ExecuteIndirect.
  • DrawIndexedX opens its own scope too, so a draw with an untranslated pipeline can no longer leave a Call::Draw behind for a later indexed draw on the thread.
  • Test: a_call_that_never_reaches_the_capture_does_not_stand_for_the_next. It covers a draw that never reaches the capture, then an indexed draw whose scope survives prepare_indexed_draw's set_call_if_unset, and nothing kept with the capture off.
  • The stacked branches are rebased on it.
<!-- greyfinch-sync:ivall/xcl:comment:7189358724 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7189358724). Originally posted by [madaraXor](https://github.com/madaraXor) on 2026-11-26T10:26:00Z. --- Thanks, confirmed and fixed (force-pushed). - The call being bound now lives for one entry point. `capture::call_scope` sets it, and its guard clears it when the entry point returns, whether or not `bind_abi` took it. This covers `DrawInstanced`, `DrawIndexedInstanced`, the dispatch and `ExecuteIndirect`. - `DrawIndexedX` opens its own scope too, so a draw with an untranslated pipeline can no longer leave a `Call::Draw` behind for a later indexed draw on the thread. - Test: `a_call_that_never_reaches_the_capture_does_not_stand_for_the_next`. It covers a draw that never reaches the capture, then an indexed draw whose scope survives `prepare_indexed_draw`'s `set_call_if_unset`, and nothing kept with the capture off. - The stacked branches are rebased on it.
Foniass commented 2026-12-01 08:03:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:03:02Z.


Triage (#1607) – head 3d496a1

This PR is stacked on #2429; only the top commit belongs here. It shares lines with #2431-#2435 because they are the rest of the same stack, so they are not duplicates. Main's XCL_CAPTURE_FRAME (b85c3161) records a frame's command stream for inspection, not a replayable single call, so it is a different tool. It does own hle/d3d12x/capture.rs, which is why this PR conflicts.
No problems found in the diff. With the variable unset, every hook returns at capture::on() or target(). bind_abi skips every matching call unless XCL_CAPTURE_RUN=1, as the description says.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304808647 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2430#issuecomment-7304808647). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:03:02Z. --- **Triage (#1607)** – head 3d496a1 This PR is stacked on #2429; only the top commit belongs here. It shares lines with #2431-#2435 because they are the rest of the same stack, so they are not duplicates. Main's `XCL_CAPTURE_FRAME` (b85c3161) records a frame's command stream for inspection, not a replayable single call, so it is a different tool. It does own `hle/d3d12x/capture.rs`, which is why this PR conflicts. No problems found in the diff. With the variable unset, every hook returns at `capture::on()` or `target()`. `bind_abi` skips every matching call unless `XCL_CAPTURE_RUN=1`, as the description says. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2430:upstream-pr/2430'
git switch 'upstream-pr/2430'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2430'
git switch 'upstream-pr/2430'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2430'
git switch 'upstream-pr/2430'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2430'
git switch 'main'
git merge --squash 'upstream-pr/2430'
git switch 'main'
git merge --ff-only 'upstream-pr/2430'
git switch 'main'
git merge 'upstream-pr/2430'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2420
No description provided.