replay: defer clamp scratch copy until split transition completes #9

Merged
battledogegames-design merged 1 commit from upstream-pr/9 into main 2026-11-26 08:17:50 +00:00
battledogegames-design commented 2026-11-25 23:15:40 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by battledogegames-design on 2026-11-25T23:15:40Z.


The clamp-capture pass in --skip-clamps uses a transition to INDIRECT_ARGUMENT as the signal to copy scratch into the replay results buffer. A split barrier carries that destination state on both halves. The editor consequently inserted transitions and a CopyBuffer after BEGIN_ONLY, while D3D12 still prohibits access to the resource.

Capture after an ordinary transition or the completing END_ONLY. Insert the copy immediately after that barrier, before any remaining barriers in the same call can change the state again. If a list cannot capture every requested clamp, return an error before replay consumes the results. The caller change propagates that error.

The synthetic regression covers a begin-only prefix, an unrelated resource transition, a pipeline bind, completion, and a second scratch transition in the same barrier call. It checks the exact command order and one copy. Existing unsplit coverage passes.

Validation on Windows, Rust 1.98.1, base 0a43566

Commands below ran in an isolated Cargo harness compiling the pinned editor and wire modules, using separate clean directories for baseline and corrected builds.

  • cargo test --locked clamp_copy_waits_for_the_end — original editor failed on the unexpected copy. Corrected regression passed.
  • cargo test --locked — all 8 editor and wire tests passed.
  • cargo build --locked and cargo clippy --locked --all-targets -- -D warnings — passed.
  • cargo check --offline in a separate harness compiled the entire replay module, including the changed caller, against real Windows bindings and compile-only stand-ins for the external GPU/PNG services.
  • Rustfmt reported the same pre-existing differences before and after the patch. Neither changed file introduced a new formatting difference.
  • Target-workspace cargo test --locked -p victory-gpu --features diagnostics --lib replay:: stopped before compilation because the registry hostname could not resolve for locked zlib-rs 0.6.8.

Thanks to tatazildo for the NVIDIA validation in #3 that prompted this review. This change covers capture completed within a command list. Cross-list capture, actual frame replay and physical GPU behavior were not validated. The relationship to debug-layer messages 538, 1003 and 527 remains unproven. #5 separately addresses the replay fixture.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6615712995 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/9). Originally posted by [battledogegames-design](https://github.com/battledogegames-design) on 2026-11-25T23:15:40Z. --- The clamp-capture pass in `--skip-clamps` uses a transition to `INDIRECT_ARGUMENT` as the signal to copy scratch into the replay results buffer. A split barrier carries that destination state on both halves. The editor consequently inserted transitions and a `CopyBuffer` after `BEGIN_ONLY`, while D3D12 still prohibits access to the resource. Capture after an ordinary transition or the completing `END_ONLY`. Insert the copy immediately after that barrier, before any remaining barriers in the same call can change the state again. If a list cannot capture every requested clamp, return an error before replay consumes the results. The caller change propagates that error. The synthetic regression covers a begin-only prefix, an unrelated resource transition, a pipeline bind, completion, and a second scratch transition in the same barrier call. It checks the exact command order and one copy. Existing unsplit coverage passes. **Validation on Windows, Rust 1.98.1, base `0a43566`** Commands below ran in an isolated Cargo harness compiling the pinned editor and wire modules, using separate clean directories for baseline and corrected builds. - `cargo test --locked clamp_copy_waits_for_the_end` — original editor failed on the unexpected copy. Corrected regression passed. - `cargo test --locked` — all 8 editor and wire tests passed. - `cargo build --locked` and `cargo clippy --locked --all-targets -- -D warnings` — passed. - `cargo check --offline` in a separate harness compiled the entire replay module, including the changed caller, against real Windows bindings and compile-only stand-ins for the external GPU/PNG services. - Rustfmt reported the same pre-existing differences before and after the patch. Neither changed file introduced a new formatting difference. - Target-workspace `cargo test --locked -p victory-gpu --features diagnostics --lib replay::` stopped before compilation because the registry hostname could not resolve for locked `zlib-rs 0.6.8`. Thanks to tatazildo for the NVIDIA validation in #3 that prompted this review. This change covers capture completed within a command list. Cross-list capture, actual frame replay and physical GPU behavior were not validated. The relationship to debug-layer messages 538, 1003 and 527 remains unproven. #5 separately addresses the replay fixture.
gomeaw commented 2026-11-25 23:23:39 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by gomeaw on 2026-11-25T23:23:39Z.


Independent validation of 3bb5980 in the target workspace on Windows x64, Rust 1.98.1.

  • All 25 replay unit tests passed with diagnostics enabled, including the split-transition regression.
  • I combined this change with #5 and changed the synthetic frame to record real BEGIN_ONLY and END_ONLY barriers for the clamp scratch buffer. An argument-buffer transition sits between them. With the PR applied, the WARP replay with --skip-clamps passed the byte-for-byte image and buffer checks.
  • Reverting only replay/edit.rs and replay/play.rs to 0a43566 made the same frame fail --skip-clamps with D3D12 IDs 534 and 535. The debug layer saw a full barrier while the split transition was pending.

This reproduces the split-barrier issue independently of the fixture errors fixed by #5. The existing --one-submit ID 527 still appears in its own experiment.

Windows comparison

AI-assisted with Codex. All inputs are synthetic.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:review:6066366078 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/9#pullrequestreview-6066366078). Originally posted by [gomeaw](https://github.com/gomeaw) on 2026-11-25T23:23:39Z. --- Independent validation of `3bb5980` in the target workspace on Windows x64, Rust 1.98.1. - All 25 replay unit tests passed with diagnostics enabled, including the split-transition regression. - I combined this change with #5 and changed the synthetic frame to record real `BEGIN_ONLY` and `END_ONLY` barriers for the clamp scratch buffer. An argument-buffer transition sits between them. With the PR applied, the WARP replay with `--skip-clamps` passed the byte-for-byte image and buffer checks. - Reverting only `replay/edit.rs` and `replay/play.rs` to `0a43566` made the same frame fail `--skip-clamps` with D3D12 IDs 534 and 535. The debug layer saw a full barrier while the split transition was pending. This reproduces the split-barrier issue independently of the fixture errors fixed by #5. The existing `--one-submit` ID 527 still appears in its own experiment. [Windows comparison](https://github.com/gomeaw/VIctory-7900XTX/actions/runs/45720214728/job/139576370914) AI-assisted with Codex. All inputs are synthetic.
avatarmanz commented 2026-11-26 07:55:01 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by avatarmanz on 2026-11-26T07:55:01Z.


Merged into main in the next push (tests pass); thanks.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7185976207 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/9#issuecomment-7185976207). Originally posted by [avatarmanz](https://github.com/avatarmanz) on 2026-11-26T07:55:01Z. --- Merged into main in the next push (tests pass); thanks.
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
avatarmanz/VIctory-7900XTX!9
No description provided.