GPU: count accepted presents while keeping title frames advancing #2935

Open
github-bot wants to merge 1 commit from github-bot/gh-2935 into main AGit
Owner

@⁠UwUCammie on GitHub · 2026-11-26 00:48 UTC · original
UwUCammie:fix/title-frames-and-presented-fps → main · +40 −7 · 2 files · 1 commits · open

An occluded window can report a positive FPS even while DXGI returns DXGI_STATUS_OCCLUDED for every Present. As discussed in #1461, the title still needs its end-of-frame work in that case. In particular, memory::log_frame advances the frame used to withhold writes and retakes the dropped ranges.

Main already runs the end-of-frame work and diagnostics hook on every returned Present, and this keeps that behavior. The change makes the FPS numerator count only S_OK. Draw counts and milliseconds per title frame keep their original denominator. An unaccepted present also leaves the diagnostics caller without a displayed-frame result.

Tested under Wine 11.22. The new regression feeds an occlusion, a failure and a success. It checks three completed title frames and one accepted present. The existing memory-withholding test passed, as did the compositor fallback and pixel test on an RX 7900 XT with RADV 26.3.1.

**@⁠UwUCammie** on GitHub · 2026-11-26 00:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935) `UwUCammie:fix/title-frames-and-presented-fps` → `main` · +40 −7 · 2 files · 1 commits · open An occluded window can report a positive FPS even while DXGI returns `DXGI_STATUS_OCCLUDED` for every `Present`. As discussed in #1461, the title still needs its end-of-frame work in that case. In particular, `memory::log_frame` advances the frame used to withhold writes and retakes the dropped ranges. Main already runs the end-of-frame work and diagnostics hook on every returned `Present`, and this keeps that behavior. The change makes the FPS numerator count only `S_OK`. Draw counts and milliseconds per title frame keep their original denominator. An unaccepted present also leaves the diagnostics caller without a displayed-frame result. Tested under Wine 11.22. The new regression feeds an occlusion, a failure and a success. It checks three completed title frames and one accepted present. The existing memory-withholding test passed, as did the compositor fallback and pixel test on an RX 7900 XT with RADV 26.3.1.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:53 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 00:53 UTC · original

The split is right on both axes: Present returning DXGI_STATUS_OCCLUDED/E_FAIL still has to end the title frame — memory::log_frame advancing withheld writes and watch::frame_done are end-of-frame work, not display work — while the reported FPS should only count presents DXGI actually accepted. The test pins exactly that distinction (three attempts → frames=3, presented=1, report_frames=3, plus completed_title_frames advancing ≥3 for every attempt). Verified.

**@⁠kotekompotek** on GitHub · 2026-11-26 00:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#issuecomment-7179215770) The split is right on both axes: `Present` returning `DXGI_STATUS_OCCLUDED`/`E_FAIL` still has to end the title frame — `memory::log_frame` advancing withheld writes and `watch::frame_done` are end-of-frame work, not display work — while the reported FPS should only count presents DXGI actually accepted. The test pins exactly that distinction (three attempts → `frames=3`, `presented=1`, `report_frames=3`, plus `completed_title_frames` advancing ≥3 for every attempt). Verified.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:02 UTC · original

Code review and RTX 5090 + WARP verification at head 720969ad8795 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/host.rs:3031-3176, 3504-3509, memory.rs:356-359):
    • end_frame(status) advances self.frames, self.report_frames, memory::log_frame() (FRAMES + retake_dropped()), and watch::frame_done() on every Present attempt (including DXGI_STATUS_OCCLUDED), while incrementing self.presented and returning shown = true only on S_OK — keeping Host::present returning None when occluded so queue::blinks does not report false black frames.
    • Meter is guarded by Host::presenter: Mutex<Presentation>, memory::FRAMES is AtomicU64, self.frames >= 1 holds whenever report runs, and displayed FPS (presented / elapsed) vs ms/title frame (frames/report_frames) stay internally consistent.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default + --features diagnostics): 0 warnings
    • RTX 5090: only_accepted_presents_count_toward_fps_but_every_attempt_ends_the_title_frame passed; --features diagnostics host::tests 13/13 and queue::tests 5/5 passed
    • WARP (--features diagnostics): host::tests 13/13 and queue::tests 5/5 passed.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#issuecomment-7179376099) Code review and RTX 5090 + WARP verification at head `720969ad8795` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/host.rs:3031-3176, 3504-3509`, `memory.rs:356-359`)**: - `end_frame(status)` advances `self.frames`, `self.report_frames`, `memory::log_frame()` (`FRAMES` + `retake_dropped()`), and `watch::frame_done()` on every `Present` attempt (including `DXGI_STATUS_OCCLUDED`), while incrementing `self.presented` and returning `shown = true` only on `S_OK` — keeping `Host::present` returning `None` when occluded so `queue::blinks` does not report false black frames. - `Meter` is guarded by `Host::presenter: Mutex<Presentation>`, `memory::FRAMES` is `AtomicU64`, `self.frames >= 1` holds whenever `report` runs, and displayed FPS (`presented / elapsed`) vs `ms/title frame` (`frames`/`report_frames`) stay internally consistent. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default + `--features diagnostics`): 0 warnings - RTX 5090: `only_accepted_presents_count_toward_fps_but_every_attempt_ends_the_title_frame` passed; `--features diagnostics` `host::tests` **13/13** and `queue::tests` **5/5** passed - WARP (`--features diagnostics`): `host::tests` **13/13** and `queue::tests` **5/5** passed. LGTM.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 01:07 UTC · original

Independent native Windows CPU verification at exact head 720969ad8795e0d1fb4b82dc5d8accaee42a1d30.

  • The synthetic accepted-present regression passed with the default features and with diagnostics. The occluded, failed, and successful presents produced three completed title frames and one accepted present.
  • The memory-withholding control and both frame-wait controls passed.

These runs add exact-head CPU coverage alongside the posted WARP report. They used no GPU or game data.

AI-assisted by Codex (gpt-6.2-sol).

**@⁠oni-swr** on GitHub · 2026-11-26 01:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#issuecomment-7179449174) Independent native Windows CPU verification at exact head `720969ad8795e0d1fb4b82dc5d8accaee42a1d30`. - The synthetic accepted-present regression passed with the default features and with `diagnostics`. The occluded, failed, and successful presents produced three completed title frames and one accepted present. - The memory-withholding control and both frame-wait controls passed. These runs add exact-head CPU coverage alongside the posted WARP report. They used no GPU or game data. AI-assisted by Codex (gpt-6.2-sol).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 04:26 UTC · original

Automated triage for the maintainers.

Merge candidate. Meter::frame in victory-gpu/src/host.rs splits into end_frame(status) and report, so the FPS figure counts only presents that returned S_OK while ms per title frame, memory::log_frame and watch::frame_done still run on every Present; present_with_compositor returns None for an unaccepted present, which queue::blinks already treats as "not black". Main already did the end-of-frame work on every Present, so the real change is the FPS numerator and the None result; the description could say that more precisely. The test checks both counters and the title-frame clock.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 04:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#issuecomment-7182594786) <!-- victory-triage v1 head=720969ad8795e0d1fb4b82dc5d8accaee42a1d30 verdict=merge-candidate at=2026-11-26T04:26:10Z --> Automated triage for the maintainers. **Merge candidate.** `Meter::frame` in `victory-gpu/src/host.rs` splits into `end_frame(status)` and `report`, so the FPS figure counts only presents that returned `S_OK` while ms per title frame, `memory::log_frame` and `watch::frame_done` still run on every `Present`; `present_with_compositor` returns `None` for an unaccepted present, which `queue::blinks` already treats as "not black". Main already did the end-of-frame work on every `Present`, so the real change is the FPS numerator and the `None` result; the description could say that more precisely. The test checks both counters and the title-frame clock. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 02:17 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-gpu --lib host::tests: all 13 crate::host::tests::* tests passed (including new only_accepted_presents_count_toward_fps_but_every_attempt_ends_the_title_frame; the single failure in the filter output is the pre-existing #1744 NVIDIA 1M view-heap cap failure in descriptor::host::tests::dynamic_slots_are_held_until_released).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Separating accepted swap-chain presents (status == S_OK) for FPS from title-frame progression (memory::frame_done() / watch::frame_done()) cleanly prevents occluded presents from stalling title-memory frame retirement while reporting accurate FPS.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#pullrequestreview-6067674867) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-gpu --lib host::tests`: all 13 `crate::host::tests::*` tests passed (including new `only_accepted_presents_count_toward_fps_but_every_attempt_ends_the_title_frame`; the single failure in the filter output is the pre-existing `#1744` NVIDIA 1M view-heap cap failure in `descriptor::host::tests::dynamic_slots_are_held_until_released`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Separating accepted swap-chain presents (`status == S_OK`) for FPS from title-frame progression (`memory::frame_done()` / `watch::frame_done()`) cleanly prevents occluded presents from stalling title-memory frame retirement while reporting accurate FPS. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 11:56 UTC · original · approved these changes

Reviewed and verified at head 720969ad against origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, D3D12 Debug Layer):

  • Design & correctness:
    • Splitting Meter::frame into end_frame(status) (crates/victory-gpu/src/host.rs:3059-3070) and report(hwnd) (host.rs:3072-3108) at the single swap_chain.Present site (host.rs:3504-3516) cleanly separates displayed swap-chain presents from title-frame progression.
    • Checking status == S_OK (host.rs:3060) distinguishes accepted presents from both DXGI_STATUS_OCCLUDED and error HRESULTs, counting only S_OK toward fps while always advancing self.frames, self.report_frames, memory::log_frame(), and watch::frame_done() so occluded windows do not stall title-memory frame retirement.
    • Returning None when !shown (host.rs:3507-3509) integrates cleanly with queue::blinks (shown.unwrap_or(false)), preventing false black-frame warnings during occlusion, and self.frames >= 1 always holds when report() runs.
  • Verification:
    • Clean git merge-tree against origin/main (63bcca43); cargo xtask policy (191 files ok); cargo clippy -p victory-gpu --all-targets -- -D warnings clean with default features and --all-features.
    • RTX 5090 (default): host::tests 31/31 (skipping pre-existing NVIDIA 1M heap-cap dynamic_slots_are_held_until_released), frame::tests 2/2, memory::tests 7/7 passed.
    • RTX 5090 + VICTORY_D3D12_DEBUG=1 (--features diagnostics): host::tests 31/31, queue::tests 5/5 passed.
    • WARP (VICTORY_D3D12_WARP=1) + VICTORY_D3D12_DEBUG=1 (--features diagnostics): host::tests 32/32 (including dynamic_slots_are_held_until_released), queue::tests 5/5, memory::tests 8/8 passed.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 11:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2935#pullrequestreview-6073722064) · **approved these changes** Reviewed and verified at head `720969ad` against `origin/main` (`63bcca43`) on Windows 11 (RTX 5090 + WARP, D3D12 Debug Layer): - **Design & correctness**: - Splitting `Meter::frame` into `end_frame(status)` (`crates/victory-gpu/src/host.rs:3059-3070`) and `report(hwnd)` (`host.rs:3072-3108`) at the single `swap_chain.Present` site (`host.rs:3504-3516`) cleanly separates displayed swap-chain presents from title-frame progression. - Checking `status == S_OK` (`host.rs:3060`) distinguishes accepted presents from both `DXGI_STATUS_OCCLUDED` and error HRESULTs, counting only `S_OK` toward `fps` while always advancing `self.frames`, `self.report_frames`, `memory::log_frame()`, and `watch::frame_done()` so occluded windows do not stall title-memory frame retirement. - Returning `None` when `!shown` (`host.rs:3507-3509`) integrates cleanly with `queue::blinks` (`shown.unwrap_or(false)`), preventing false black-frame warnings during occlusion, and `self.frames >= 1` always holds when `report()` runs. - **Verification**: - Clean `git merge-tree` against `origin/main` (`63bcca43`); `cargo xtask policy` (`191 files ok`); `cargo clippy -p victory-gpu --all-targets -- -D warnings` clean with default features and `--all-features`. - RTX 5090 (default): `host::tests` **31/31** (skipping pre-existing NVIDIA 1M heap-cap `dynamic_slots_are_held_until_released`), `frame::tests` **2/2**, `memory::tests` **7/7** passed. - RTX 5090 + `VICTORY_D3D12_DEBUG=1` (`--features diagnostics`): `host::tests` **31/31**, `queue::tests` **5/5** passed. - WARP (`VICTORY_D3D12_WARP=1`) + `VICTORY_D3D12_DEBUG=1` (`--features diagnostics`): `host::tests` **32/32** (including `dynamic_slots_are_held_until_released`), `queue::tests` **5/5**, `memory::tests` **8/8** passed. LGTM.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2935/head:github-bot/gh-2935'
git switch 'github-bot/gh-2935'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2935'
git switch 'github-bot/gh-2935'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2935'
git switch 'github-bot/gh-2935'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2935'
git switch 'main'
git merge --squash 'github-bot/gh-2935'
git switch 'main'
git merge --ff-only 'github-bot/gh-2935'
git switch 'main'
git merge 'github-bot/gh-2935'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2935
No description provided.