Count a frame only after DXGI accepts the present #17

Manually merged
github merged 1 commit from github-bot/gh-17 into main 2026-11-26 08:21:45 +00:00 AGit
Owner

@⁠UwUCammie on GitHub · 2026-11-25 23:36 UTC · original
UwUCammie:fix/avatarmanz-count-accepted-presents → main · +41 −3 · 1 files · 1 commits · merged 2026-11-26 08:17 UTC

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.

**@⁠UwUCammie** on GitHub · 2026-11-25 23:36 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/17) `UwUCammie:fix/avatarmanz-count-accepted-presents` → `main` · +41 −3 · 1 files · 1 commits · merged 2026-11-26 08:17 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:20 +00:00
Author
Owner

@⁠Adika713 on GitHub · 2026-11-26 00:19 UTC · original

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.

**@⁠Adika713** on GitHub · 2026-11-26 00:19 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7178638876) 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.
Author
Owner

@⁠gomeaw on GitHub · 2026-11-25 23:41 UTC · original · reviewed

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.

**@⁠gomeaw** on GitHub · 2026-11-25 23:41 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#pullrequestreview-6066539954) · **reviewed** 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.
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-26 05:28 UTC · original

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.

**@⁠MoonYueya** on GitHub · 2026-11-26 05:28 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7183521001) 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.*
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:55 UTC · original

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

**@⁠avatarmanz** on GitHub · 2026-11-26 07:55 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/17#issuecomment-7185978504) Merged into main in the next push (tests pass); thanks.
github manually merged commit 64d2b76c7b into main 2026-11-26 08:21:45 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.