GPU diagnostics: name the first observed black frame accurately #2835

Open
109User109 wants to merge 3 commits from upstream-pr/2837 into main
109User109 commented 2026-11-25 21:48:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 109User109 on 2026-11-25T21:48:59Z.


Problem

The black-frame diagnostic starts with LAST = false. When the first sampled frame is black, it says "a black frame after a frame that was not", although no previous frame was sampled. This showed up while investigating a Windows run on an AMD integrated GPU.

Change

Track whether a prior frame was sampled. Label the first observed black frame separately, and keep the existing transition message when a sampled nonblack frame precedes it. An unsampled present does not replace the last known result. The new unit test covers first black, a real transition, repeated black, and unsampled/nonblack frames.

Verification

  • cargo xtask policy: 186 files ok.
  • git diff --check: clean.
  • Tried cargo test -p victory-gpu --features diagnostics black_frame_tests --locked on Linux. The existing Linux build fails first in resource.rs because IDLE_FRAMES and IDLE_MS are unavailable under that target, so the new test could not run here. The repository's Windows CI runs the unit test.

No game files or captures are included. Assisted by OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5499750517 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837). Originally posted by [109User109](https://github.com/109User109) on 2026-11-25T21:48:59Z. --- ## Problem The black-frame diagnostic starts with `LAST = false`. When the first sampled frame is black, it says "a black frame after a frame that was not", although no previous frame was sampled. This showed up while investigating a Windows run on an AMD integrated GPU. ## Change Track whether a prior frame was sampled. Label the first observed black frame separately, and keep the existing transition message when a sampled nonblack frame precedes it. An unsampled present does not replace the last known result. The new unit test covers first black, a real transition, repeated black, and unsampled/nonblack frames. ## Verification - `cargo xtask policy`: 186 files ok. - `git diff --check`: clean. - Tried `cargo test -p victory-gpu --features diagnostics black_frame_tests --locked` on Linux. The existing Linux build fails first in `resource.rs` because `IDLE_FRAMES` and `IDLE_MS` are unavailable under that target, so the new test could not run here. The repository's Windows CI runs the unit test. No game files or captures are included. Assisted by OpenAI Codex.
kotekompotek commented 2026-11-25 21:51:31 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T21:51:31Z.

Review: COMMENTED


Correct: Option tracking distinguishes 'first observed black' from 'black after non-black', and shown.or(last.0) keeps the last known state across frames with no copy info — so a black frame following unknown state doesn't re-trigger 'after a frame that was not'. The extracted black_frame_message is testable. LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6065471711 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#pullrequestreview-6065471711). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T21:51:31Z. **Review:** COMMENTED --- Correct: Option<bool> tracking distinguishes 'first observed black' from 'black after non-black', and shown.or(last.0) keeps the last known state across frames with no copy info — so a black frame following unknown state doesn't re-trigger 'after a frame that was not'. The extracted black_frame_message is testable. LGTM.
oni-swr commented 2026-11-25 23:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T22:28:35Z.


Independent Windows verification of exact head d151391c71a9dd7ef8f94b526a11ab8b9f81e908 against main at f3578e3.

cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib passed 203 tests, including the first-black-frame regression, with one benchmark ignored. Main passed 243 tests with one benchmark ignored. DXGI reported the Microsoft software adapter (VendorId=0x1414, Flags=0x2). This head merges cleanly into current main and alongside #2838–#2840.

The regression confirms the first observed black frame is distinct from a transition. The code retains the prior sample when a present has no sample. Claude’s earlier negative control on the integration branch failed when the first black frame was reported as a transition again.

Fresh verification and review by Codex (gpt-6.2-sol). Synthetic inputs only, with both WARP switches set and Windows SDK dxil.dll.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176408550 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7176408550). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T22:28:35Z. --- Independent Windows verification of exact head `d151391c71a9dd7ef8f94b526a11ab8b9f81e908` against `main` at `f3578e3`. `cargo test -j 4 --locked -p victory-gpu --features diagnostics --lib` passed 203 tests, including the first-black-frame regression, with one benchmark ignored. Main passed 243 tests with one benchmark ignored. DXGI reported the Microsoft software adapter (`VendorId=0x1414`, `Flags=0x2`). This head merges cleanly into current main and alongside #2838–#2840. The regression confirms the first observed black frame is distinct from a transition. The code retains the prior sample when a present has no sample. Claude’s earlier negative control on the integration branch failed when the first black frame was reported as a transition again. Fresh verification and review by Codex (`gpt-6.2-sol`). Synthetic inputs only, with both WARP switches set and Windows SDK `dxil.dll`.
fuzeofficlal commented 2026-11-26 00:24:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:24:32Z.

Review: COMMENTED


Verified head d151391c cleanly merged onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).

Code Review

  • Switching LAST from bool to Option<bool> with shown.or(last.0) cleanly preserves the previous sampled state across unsampled frames and accurately separates None -> Some(true) ("first observed black frame") from Some(false) -> Some(true) ("a black frame after a frame that was not").

Local Verification (--features diagnostics)

  • RTX 5090 & WARP (VICTORY_D3D12_DEBUG=1): black_frame_tests + queue::tests: 6/6 passed on both adapters.
  • WARP (full victory-gpu --features diagnostics --lib): 247/247 passed (1 ignored).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) & cargo xtask policy (191 files ok): clean.

Looks clean and ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066883107 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#pullrequestreview-6066883107). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:24:32Z. **Review:** COMMENTED --- Verified head `d151391c` cleanly merged onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + `VICTORY_D3D12_DEBUG=1`). ### Code Review - Switching `LAST` from `bool` to `Option<bool>` with `shown.or(last.0)` cleanly preserves the previous sampled state across unsampled frames and accurately separates `None -> Some(true)` (`"first observed black frame"`) from `Some(false) -> Some(true)` (`"a black frame after a frame that was not"`). ### Local Verification (`--features diagnostics`) - **RTX 5090 & WARP (`VICTORY_D3D12_DEBUG=1`)**: `black_frame_tests` + `queue::tests`: **6/6 passed** on both adapters. - **WARP (full `victory-gpu --features diagnostics --lib`)**: **247/247 passed** (1 ignored). - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) & `cargo xtask policy` (`191 files ok`): clean. Looks clean and ready to merge.
andrewpozdnakov7-jpg commented 2026-11-26 02:07:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T01:51:51Z.


I found one production path that still loses the unknown state. Host::present used Some(probe.is_some_and(...)), so a presentation without a sample told your new warning logic that the frame was nonblack.

714b6ea is one commit directly on d151391c71a9dd7ef8f94b526a11ab8b9f81e908. The same Windows/WARP test presents RGBA8 black, FP16, RGBA8 black, and RGBA8 color. It verifies the FP16 swap-chain format and observes [true, false, true, false] before, then [true, None, true, false]. Six paired runs, full GPU diagnostics (204 passed, 1 ignored), strict Clippy, and asset policy passed on the exact branch. I also checked the change with the current multiplane presenter and #2962 on main 63bcca4, adapting the fixture call to the new signature. All 249 GPU diagnostics tests passed there, with one ignored.

If you take the patch or test, please preserve its Git author. If you fold it into another commit, please add:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180217452 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7180217452). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T01:51:51Z. --- I found one production path that still loses the unknown state. `Host::present` used `Some(probe.is_some_and(...))`, so a presentation without a sample told your new warning logic that the frame was nonblack. [714b6ea](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/714b6ea509fcee4cce50d87f03421ac63e700567) is one commit directly on `d151391c71a9dd7ef8f94b526a11ab8b9f81e908`. The same Windows/WARP test presents RGBA8 black, FP16, RGBA8 black, and RGBA8 color. It verifies the FP16 swap-chain format and observes `[true, false, true, false]` before, then `[true, None, true, false]`. Six paired runs, full GPU diagnostics (204 passed, 1 ignored), strict Clippy, and asset policy passed on the exact branch. I also checked the change with the current multiplane presenter and #2962 on main `63bcca4`, adapting the fixture call to the new signature. All 249 GPU diagnostics tests passed there, with one ignored. If you take the patch or test, please preserve its Git author. If you fold it into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
steven-seagull27 commented 2026-11-26 03:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T02:16:01Z.


I checked the warning emitted after real Host::present results reach this PR's blinks logic on RTX 5080 and WARP. With #2962 and #2827 present, a sequence of RGB10 red 30 → FP16 → RGB10 red 30 triggered a spurious black transition on each adapter. Both RGB10 frames had the same decoded PNG red value (7) and the same sampled level (7).

With the return expression from Andrew's 714b6ea, FP16 returned None, the level history stayed intact and the duplicate warning disappeared. The opposite control — RGB10 green 31 → FP16 → RGB10 blue 30 — still emitted the real nonblack-to-black transition. Across 30 presents per adapter the patch removed precisely three spurious warnings, one per RGB10 resource format. All 30 swap-chain calls returned S_OK, including FP16.

I forwarded the actual host return into blinks in a local test fixture and recorded its message choice. Windows build 26300.10075, NVIDIA driver 621.40. Tested with Codex assistance.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180627906 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7180627906). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T02:16:01Z. --- I checked the warning emitted **after** real `Host::present` results reach this PR's `blinks` logic on RTX 5080 and WARP. With #2962 and #2827 present, a sequence of RGB10 red 30 → FP16 → RGB10 red 30 triggered a spurious black transition on each adapter. Both RGB10 frames had the same decoded PNG red value (7) and the same sampled level (7). With the return expression from Andrew's [`714b6ea`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/714b6ea509fcee4cce50d87f03421ac63e700567), FP16 returned `None`, the level history stayed intact and the duplicate warning disappeared. The opposite control — RGB10 green 31 → FP16 → RGB10 blue 30 — still emitted the real nonblack-to-black transition. Across 30 presents per adapter the patch removed precisely three spurious warnings, one per RGB10 resource format. All 30 swap-chain calls returned `S_OK`, including FP16. I forwarded the actual host return into `blinks` in a local test fixture and recorded its message choice. Windows build 26300.10075, NVIDIA driver 621.40. Tested with Codex assistance.
Marvisak commented 2026-11-26 04:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T03:22:31Z.


Automated triage for the maintainers.

Verdict: needs work. The relabelling in blinks (crates/victory-gpu/src/queue.rs) is fine, and black_frame_message is tested.

But the PR says "an unsampled present does not replace the last known result", and in production that does not hold: Host::present (crates/victory-gpu/src/host.rs, ~3483) returns Some(probe.is_some_and(...)), so a present that took no sample arrives as Some(false) and is still taken as a nonblack frame. Two comments above show this producing spurious transition warnings. Please have Host::present return None when no probe was taken (as in the commit linked by andrewpozdnakov7-jpg, with credit) so the new Option state actually reaches blinks.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181662697 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7181662697). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T03:22:31Z. --- <!-- victory-triage v1 head=d151391c71a9dd7ef8f94b526a11ab8b9f81e908 verdict=needs-work at=2026-11-26T03:22:30Z --> Automated triage for the maintainers. **Verdict: needs work.** The relabelling in `blinks` (`crates/victory-gpu/src/queue.rs`) is fine, and `black_frame_message` is tested. But the PR says "an unsampled present does not replace the last known result", and in production that does not hold: `Host::present` (`crates/victory-gpu/src/host.rs`, ~3483) returns `Some(probe.is_some_and(...))`, so a present that took no sample arrives as `Some(false)` and is still taken as a nonblack frame. Two comments above show this producing spurious transition warnings. Please have `Host::present` return `None` when no probe was taken (as in the commit linked by andrewpozdnakov7-jpg, with credit) so the new `Option` state actually reaches `blinks`. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
109User109 commented 2026-11-26 13:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 109User109 on 2026-11-26T13:00:41Z.


Applied @andrewpozdnakov7-jpg's patch as a2fdd67a on top of this PR, preserving the original Git author.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

<!-- greyfinch-sync:Marvisak/VIctory:comment:7192753567 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7192753567). Originally posted by [109User109](https://github.com/109User109) on 2026-11-26T13:00:41Z. --- Applied @andrewpozdnakov7-jpg's patch as [`a2fdd67a`](https://github.com/109User109/VIctory/commit/a2fdd67a5501893f976402d694ea4be72876897a) on top of this PR, preserving the original Git author. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
andrewpozdnakov7-jpg commented 2026-11-26 14:01:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T13:16:59Z.


@109User109 thanks for preserving the author on a2fdd67. I resolved its conflict with upstream 63bcca43 in 1f68349. The merge keeps a2fdd67 as its first parent and adapts the black-probe test to the current multi-plane Host::present signature.

The real WARP swap-chain test returned [Some(true), None, Some(true), Some(false)] for black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8. The compositor failure/recovery test and the first-observed-black message test also passed. With app-local Agility/WARP, the full GPU diagnostics suite had 249 passes and 1 ignored, and strict GPU Clippy passed with all features.

You can fast-forward this branch to the merge commit if you want to take the resolution. If moving the probe test separately, please retain its Git author or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> when folding it into another commit. AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7193125992 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7193125992). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T13:16:59Z. --- @109User109 thanks for preserving the author on `a2fdd67`. I resolved its conflict with upstream `63bcca43` in [`1f68349`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/1f6834929c87c436a7e6c3735c9ba20ca748d095). The merge keeps `a2fdd67` as its first parent and adapts the black-probe test to the current multi-plane `Host::present` signature. The real WARP swap-chain test returned `[Some(true), None, Some(true), Some(false)]` for black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8. The compositor failure/recovery test and the first-observed-black message test also passed. With app-local Agility/WARP, the full GPU diagnostics suite had 249 passes and 1 ignored, and strict GPU Clippy passed with all features. You can fast-forward this branch to the merge commit if you want to take the resolution. If moving the probe test separately, please retain its Git author or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` when folding it into another commit. AI-assisted with Codex.
109User109 commented 2026-11-26 15:02:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 109User109 on 2026-11-26T14:18:58Z.


Fast-forwarded the PR branch to @andrewpozdnakov7-jpg's merge resolution 1f683492, which keeps a2fdd67 as first parent and resolves the conflict with current main.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7194617480 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7194617480). Originally posted by [109User109](https://github.com/109User109) on 2026-11-26T14:18:58Z. --- Fast-forwarded the PR branch to @andrewpozdnakov7-jpg's merge resolution [`1f683492`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/1f6834929c87c436a7e6c3735c9ba20ca748d095), which keeps `a2fdd67` as first parent and resolves the conflict with current `main`.
andrewpozdnakov7-jpg commented 2026-11-28 19:39:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T19:39:51Z.


I checked 1f68349 with the DXGI present status handling in #3785. Combined d43d682 keeps both exact PR heads.

The black-frame check still reports a first observation separately from a transition. It keeps the last sample when a frame has no sample. The WARP fixture delivered black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8 in order and returned Some(true), None, Some(true), Some(false). The status and retry tests passed in the same three runs, along with compositor recovery, strict all-feature GPU Clippy and the asset policy.

The maintainer can use the branch if these changes land together. Please retain the Git authors on cherry-pick or rebase.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7244713098 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7244713098). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T19:39:51Z. --- I checked 1f68349 with the DXGI present status handling in #3785. [Combined d43d682](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/d43d682f90abc20d97f9aef1ff1bc87b4d509b8e) keeps both exact PR heads. The black-frame check still reports a first observation separately from a transition. It keeps the last sample when a frame has no sample. The WARP fixture delivered black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8 in order and returned Some(true), None, Some(true), Some(false). The status and retry tests passed in the same three runs, along with compositor recovery, strict all-feature GPU Clippy and the asset policy. The maintainer can use the branch if these changes land together. Please retain the Git authors on cherry-pick or rebase. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 20:20:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T20:20:41Z.


I refreshed the integration for #3785's accepted-present change. Combined aeb634d keeps both exact heads.

In the unadjusted merge, the hidden WARP window returned None after all four present attempts. The updated fixture reads the actual probe after rendering and before DXGI Present. It verified black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8 as Some(true), None, Some(true), Some(false). Any accepted result is also checked against the probe. Six focused tests passed in each of three WARP runs, plus strict all-feature GPU Clippy and the asset policy.

The maintainer can use this refreshed branch if the changes land together. Please retain the Git authors on cherry-pick or rebase.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7245217057 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2837#issuecomment-7245217057). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T20:20:41Z. --- I refreshed the integration for #3785's accepted-present change. [Combined aeb634d](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/aeb634d5c2ef1bfe241aad80c4398d522e248db9) keeps both exact heads. In the unadjusted merge, the hidden WARP window returned None after all four present attempts. The updated fixture reads the actual probe after rendering and before DXGI Present. It verified black RGBA8, unprobed FP16, black RGBA8 and nonblack RGBA8 as Some(true), None, Some(true), Some(false). Any accepted result is also checked against the probe. Six focused tests passed in each of three WARP runs, plus strict all-feature GPU Clippy and the asset policy. The maintainer can use this refreshed branch if the changes land together. Please retain the Git authors on cherry-pick or rebase. AI-assisted with OpenAI 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/2837:upstream-pr/2837'
git switch 'upstream-pr/2837'

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