Count a frame only after DXGI accepts the present #17

Merged
UwUCammie merged 1 commit from upstream-pr/17 into main 2026-11-26 08:17:50 +00:00
UwUCammie commented 2026-11-25 23:36:30 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by UwUCammie on 2026-11-25T23:36:30Z.


The window’s FPS counter increases when DXGI reports that the window is occluded or that the present failed. That makes recorded frame rates unreliable when diagnosing a stall.

Count the frame and update the diagnostic panel only when the swap chain returns S_OK. A change to a failing or occluded status produces one warning. The title’s queue still finishes its frame normally, including its timeline and diagnostic callbacks. The upstream discussion explains why keeping that distinction matters. Marvisak/VIctory#1461

The regression test feeds the meter a success, an occlusion, two failures and a recovery, and checks that it counts two frames. It passed under Wine 11.22. I also built the optimized diagnostic executable. Test host was an RX 7900 XT with RADV 26.3.1. This is the corresponding change from the fxceless fork, adapted to the panel here.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6615999863 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/17). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-25T23:36:30Z. --- The window’s FPS counter increases when DXGI reports that the window is occluded or that the present failed. That makes recorded frame rates unreliable when diagnosing a stall. Count the frame and update the diagnostic panel only when the swap chain returns `S_OK`. A change to a failing or occluded status produces one warning. The title’s queue still finishes its frame normally, including its timeline and diagnostic callbacks. The upstream discussion explains why keeping that distinction matters. [Marvisak/VIctory#1461](https://github.com/Marvisak/VIctory/pull/1461#issuecomment-7175836301) The regression test feeds the meter a success, an occlusion, two failures and a recovery, and checks that it counts two frames. It passed under Wine 11.22. I also built the optimized diagnostic executable. Test host was an RX 7900 XT with RADV 26.3.1. This is the corresponding change from [the fxceless fork](https://github.com/fxceless/victory-fork/pull/1154), adapted to the panel here.
gomeaw commented 2026-11-25 23:41:31 +00:00 (Migrated from github.com)

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


I ran the_meter_counts_successful_presents_across_a_failure from 8699d96 on native Windows with both the default and diagnostics builds. Both passed. Windows run

I noticed one follow-on effect in the black-frame diagnostic. A failed or occluded present now returns None to queue::blinks. That path currently uses shown.unwrap_or(false) and sets LAST to the result. An accepted black frame, an occluded present, then another accepted black frame would therefore be logged as a second onset of black. For captures used to diagnose the NVIDIA stalls, preserving the last accepted frame's black state across None would keep those transitions accurate. The per-title-frame draw drain can still run on every call.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:review:6066539954 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#pullrequestreview-6066539954). Originally posted by [gomeaw](https://github.com/gomeaw) on 2026-11-25T23:41:31Z. --- I ran `the_meter_counts_successful_presents_across_a_failure` from `8699d96` on native Windows with both the default and diagnostics builds. Both passed. [Windows run](https://github.com/gomeaw/VIctory-7900XTX/actions/runs/45722886167) I noticed one follow-on effect in the black-frame diagnostic. A failed or occluded present now returns `None` to `queue::blinks`. That path currently uses `shown.unwrap_or(false)` and sets `LAST` to the result. An accepted black frame, an occluded present, then another accepted black frame would therefore be logged as a second onset of black. For captures used to diagnose the NVIDIA stalls, preserving the last accepted frame's black state across `None` would keep those transitions accurate. The per-title-frame draw drain can still run on every call.
Adika713 commented 2026-11-26 00:19:37 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Adika713 on 2026-11-26T00:19:37Z.


I rechecked 8699d96 on native Windows (RX 6950 XT, Ryzen 5 3600, rustc/cargo 1.98.1), with serial tests (CARGO_BUILD_JOBS=1, --test-threads=1). cargo test --locked -p victory-gpu --lib present_status_tests -- --test-threads=1 gives 1 passed, 0 failed. The unmodified full lib run has one failure, descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in; that exact test fails 10/10 on unmodified main 0a43566 as well, so it is pre-existing. With only that test skipped, PR #17 gives 326 passed, 0 failed, 34 ignored versus 325 passed, 0 failed, 34 ignored on main.

I also read the follow-on effect in the existing review and can confirm it in the code at queue.rs:1024: shown.unwrap_or(false) turns a failed or occluded present into “black”, which will reset LAST and can log a false second black onset. Preserving the last accepted frame's black state while still taking the per-frame draw counters looks like the right adjustment. I made no repository change.

AI-assisted: OpenCode, model Big Pickle. No game data.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7178638876 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7178638876). Originally posted by [Adika713](https://github.com/Adika713) on 2026-11-26T00:19:37Z. --- I rechecked `8699d96` on native Windows (RX 6950 XT, Ryzen 5 3600, rustc/cargo 1.98.1), with serial tests (`CARGO_BUILD_JOBS=1`, `--test-threads=1`). `cargo test --locked -p victory-gpu --lib present_status_tests -- --test-threads=1` gives `1 passed, 0 failed`. The unmodified full lib run has one failure, `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in`; that exact test fails 10/10 on unmodified `main` `0a43566` as well, so it is pre-existing. With only that test skipped, PR #17 gives `326 passed, 0 failed, 34 ignored` versus `325 passed, 0 failed, 34 ignored` on `main`. I also read the follow-on effect in the existing review and can confirm it in the code at `queue.rs:1024`: `shown.unwrap_or(false)` turns a failed or occluded present into “black”, which will reset `LAST` and can log a false second black onset. Preserving the last accepted frame's black state while still taking the per-frame draw counters looks like the right adjustment. I made no repository change. AI-assisted: OpenCode, model Big Pickle. No game data.
MoonYueya commented 2026-11-26 05:28:44 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by MoonYueya on 2026-11-26T05:28:44Z.


Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into MoonYueya/VIctory-Kira a3de053 on top of e2a28ec together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17).

  • cargo test --workspace --locked --no-fail-fast -- --test-threads=1: 936 passed, 0 failed, 45 ignored after this PR was merged (never below the count before it; the branch started at 923).
  • No "swap chain did not present" warning appeared in any run.
  • With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader.

What this does not show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality.

AI-assisted.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7183521001 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7183521001). Originally posted by [MoonYueya](https://github.com/MoonYueya) on 2026-11-26T05:28:44Z. --- Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into [MoonYueya/VIctory-Kira](https://github.com/MoonYueya/VIctory-Kira) `a3de053` on top of `e2a28ec` together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17). - `cargo test --workspace --locked --no-fail-fast -- --test-threads=1`: **936 passed, 0 failed, 45 ignored** after this PR was merged (never below the count before it; the branch started at 923). - No "swap chain did not present" warning appeared in any run. - With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader. What this does **not** show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality. *AI-assisted.*
avatarmanz commented 2026-11-26 07:55:08 +00:00 (Migrated from github.com)

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


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:comment:7185978504 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7185978504). Originally posted by [avatarmanz](https://github.com/avatarmanz) on 2026-11-26T07:55:08Z. --- 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!17
No description provided.