GPU diagnostics: encode completed frame captures off the present thread #142

Open
Cuebert wants to merge 1 commit from upstream-pr/142 into main
Cuebert commented 2026-11-24 21:49:18 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Cuebert on 2026-11-24T21:49:18Z.


The diagnostic capture path encodes and writes each PNG between the GPU copy completing and the swap chain presenting. This can delay a frame even when the GPU is ready.

Move the completed readback to one encoder thread. It owns the D3D12 resource until the PNG is written. The queue holds two waiting frames and applies backpressure when full. Normal title exit drains the queue. VICTORY_CAPTURE_SYNC=1 keeps a requested frame on the synchronous path for crash investigations.

Verification

  • On Windows, the GPU diagnostics suite passed 118 tests with one ignored. The new regression queued four padded BGRA readbacks, exited through the title's CRT exit path and compared every PNG byte with the synchronous reference. It passed on hardware and WARP. Disabling the exit drain made the test fail with a missing frame.
  • cargo test --workspace --locked passed 496 tests with seven ignored. Workspace all-target, all-feature Clippy with warnings denied and the staged asset-policy check passed.

The change affects diagnostic screenshots. Whole-game frame time was not measured on this head. AI-assisted development and testing with Codex.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592094817 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/142). Originally posted by [Cuebert](https://github.com/Cuebert) on 2026-11-24T21:49:18Z. --- The diagnostic capture path encodes and writes each PNG between the GPU copy completing and the swap chain presenting. This can delay a frame even when the GPU is ready. Move the completed readback to one encoder thread. It owns the D3D12 resource until the PNG is written. The queue holds two waiting frames and applies backpressure when full. Normal title exit drains the queue. `VICTORY_CAPTURE_SYNC=1` keeps a requested frame on the synchronous path for crash investigations. ### Verification - On Windows, the GPU diagnostics suite passed 118 tests with one ignored. The new regression queued four padded BGRA readbacks, exited through the title's CRT exit path and compared every PNG byte with the synchronous reference. It passed on hardware and WARP. Disabling the exit drain made the test fail with a missing frame. - `cargo test --workspace --locked` passed 496 tests with seven ignored. Workspace all-target, all-feature Clippy with warnings denied and the staged asset-policy check passed. The change affects diagnostic screenshots. Whole-game frame time was not measured on this head. AI-assisted development and testing with Codex.
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/142:upstream-pr/142'
git switch 'upstream-pr/142'

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