xcl run: xcl replay translates the shaders of a capture again #2423

Open
madaraXor wants to merge 5 commits from upstream-pr/2433 into main
madaraXor commented 2026-11-25 18:38:12 +00:00 (Migrated from github.com)

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


xcl replay <capture folder> reads a capture written by XCL_CAPTURE_DRAW and translates and compiles its console shaders again with this build's translator. The call itself is run by the next PR; this part needs no GPU and shows what a translator change does to a captured shader. Part of #675.

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

What is in it

  • replay.rs: options, the manifest, translate (the memory windows and the split flag of the capture run come from the manifest; static samplers numbered across stages as in a pipeline), the HLSL written to <capture>\replay_<name>\.
  • main.rs, lib.rs: the command and its help.
  • Test: a capture built in the test (a VS and a PS of our own in console containers, xbox::tests; no title's data) translates and compiles; options.
  • Review fixes: --out is one plain name (no way out of the capture folder); a capture with a GS (the capture writes the rect-list stand-in) is refused up front, before anything is written (replayable). Tests: options_parse, a_capture_with_a_gs_is_refused.

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
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on d0bad53: 1437 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

  • The runtime is not changed (a new command).

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: d0bad53fe7b8073002605a94c4c0b65798641415
gpu: AMD Radeon RX 6700 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 936 (PresentX 936)
presents per 2 s (last 3): 49 60 59
device removals: 0
crashes: 0
peak commit: 17121 MB

Not tested

  • Compute captures; console geometry and mesh stages (refused).
  • The direct DXIL translator (XCL_DIRECT_DXIL): the replay uses the HLSL path.

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:5497044420 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433). Originally posted by [madaraXor](https://github.com/madaraXor) on 2026-11-25T18:38:12Z. --- `xcl replay <capture folder>` reads a capture written by `XCL_CAPTURE_DRAW` and translates and compiles its console shaders again with this build's translator. The call itself is run by the next PR; this part needs no GPU and shows what a translator change does to a captured shader. Part of #675. Stacked on #2432; only the top commit belongs here. **What is in it** - `replay.rs`: options, the manifest, `translate` (the memory windows and the split flag of the capture run come from the manifest; static samplers numbered across stages as in a pipeline), the HLSL written to `<capture>\replay_<name>\`. - `main.rs`, `lib.rs`: the command and its help. - Test: a capture built in the test (a VS and a PS of our own in console containers, `xbox::tests`; no title's data) translates and compiles; options. - Review fixes: `--out` is one plain name (no way out of the capture folder); a capture with a GS (the capture writes the rect-list stand-in) is refused up front, before anything is written (`replayable`). Tests: `options_parse`, `a_capture_with_a_gs_is_refused`. **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 - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `d0bad53`: 1437 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** - The runtime is not changed (a new command). `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: d0bad53fe7b8073002605a94c4c0b65798641415 gpu: AMD Radeon RX 6700 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 936 (PresentX 936) presents per 2 s (last 3): 49 60 59 device removals: 0 crashes: 0 peak commit: 17121 MB ``` **Not tested** - Compute captures; console geometry and mesh stages (refused). - The direct DXIL translator (`XCL_DIRECT_DXIL`): the replay uses the HLSL path. **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)
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:21Z.


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 a_capture_s_shaders_translate_and_compile: passed.

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

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


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:7172930500 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433#issuecomment-7172930500). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T19:54:39Z. --- 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!
bmjask commented 2026-11-25 20:53:05 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Not merge-ready. Capture producer records GS, but replay translation accepts only VS/PS/CS and errors on GS, so a successfully captured geometry draw cannot replay. Add GS support or clearly reject/document unsupported capture types with tests. Also --out is directly joined into replay_; components such as x/../../outside can escape the capture directory. Restrict it to a single normal component or canonicalize/verify containment; constrain manifest shader file paths too. Current Windows Build/test fails.

<!-- greyfinch-sync:ivall/xcl:review:6064834461 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433#pullrequestreview-6064834461). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T20:53:05Z. **Review:** COMMENTED --- Not merge-ready. Capture producer records GS, but replay translation accepts only VS/PS/CS and errors on GS, so a successfully captured geometry draw cannot replay. Add GS support or clearly reject/document unsupported capture types with tests. Also --out is directly joined into replay_<value>; components such as x/../../outside can escape the capture directory. Restrict it to a single normal component or canonicalize/verify containment; constrain manifest shader file paths too. Current Windows Build/test fails.
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:55Z.


Thanks, fixed in the force-pushed commit:

  • GS: the capture writes a pipeline's GS (the rect-list stand-in), which replay does not run. xcl replay now refuses such a capture up front (replayable), with "the capture has a gs shader: xcl replay runs draws with a VS and PS, or dispatches", before anything is translated or written. The module doc says so. Test: a_capture_with_a_gs_is_refused.
  • --out: it must be one plain name (plain_name), so x/../../outside, .., a\b, C:\x and /x are usage errors. Test: options_parse.
  • Manifest file paths: shader, memory and texture file names are checked on read in #2429's Manifest::check, so nothing outside the capture folder is read.
<!-- greyfinch-sync:ivall/xcl:comment:7177970414 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433#issuecomment-7177970414). Originally posted by [madaraXor](https://github.com/madaraXor) on 2026-11-25T23:43:55Z. --- Thanks, fixed in the force-pushed commit: - **GS:** the capture writes a pipeline's GS (the rect-list stand-in), which replay does not run. `xcl replay` now refuses such a capture up front (`replayable`), with "the capture has a gs shader: xcl replay runs draws with a VS and PS, or dispatches", before anything is translated or written. The module doc says so. Test: `a_capture_with_a_gs_is_refused`. - **`--out`:** it must be one plain name (`plain_name`), so `x/../../outside`, `..`, `a\b`, `C:\x` and `/x` are usage errors. Test: `options_parse`. - **Manifest file paths:** shader, memory and texture file names are checked on read in #2429's `Manifest::check`, so nothing outside the capture folder is read.
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:28Z.


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:7180567678 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433#issuecomment-7180567678). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T02:12:28Z. --- 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
Foniass commented 2026-12-01 08:03:50 +00:00 (Migrated from github.com)

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


Triage (#1607) – head d0bad53

This PR is stacked on #2432; only the top commit (replay.rs, the xcl replay command) belongs here. #2434 and #2435 continue the same stack, and no other PR adds a replay command.
One problem in replay.rs:translate: windows = (m.mem_windows & 0xFF).max(1) drops HEAP_WINDOWS/HEAP_FLAT. A capture from an XCL_HEAP_WINDOWS=1 run is therefore translated in the switch form, and with 8 or 16 windows that form cannot represent the count. The description says the capture run's windows come from the manifest, so the flags should be passed through.
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:7304825584 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2433#issuecomment-7304825584). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:03:50Z. --- **Triage (#1607)** – head d0bad53 This PR is stacked on #2432; only the top commit (`replay.rs`, the `xcl replay` command) belongs here. #2434 and #2435 continue the same stack, and no other PR adds a replay command. One problem in `replay.rs:translate`: `windows = (m.mem_windows & 0xFF).max(1)` drops `HEAP_WINDOWS`/`HEAP_FLAT`. A capture from an `XCL_HEAP_WINDOWS=1` run is therefore translated in the switch form, and with 8 or 16 windows that form cannot represent the count. The description says the capture run's windows come from the manifest, so the flags should be passed through. 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/2433:upstream-pr/2433'
git switch 'upstream-pr/2433'

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/2433'
git switch 'upstream-pr/2433'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2433'
git switch 'upstream-pr/2433'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2433'
git switch 'main'
git merge --squash 'upstream-pr/2433'
git switch 'main'
git merge --ff-only 'upstream-pr/2433'
git switch 'main'
git merge 'upstream-pr/2433'
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!2423
No description provided.