FPS line: its texture is the strip it shows, not the whole F1 box #4284

Closed
github-bot wants to merge 11 commits from github-bot/gh-4283 into main AGit
Owner

@⁠Kam471 on GitHub · 2026-11-30 18:10 UTC · original
Kam471:fps-line-strip → main · +851 −852 · 32 files · 11 commits · closed without merging

What it changes

With F1 closed, VICTORY_FPS_LINE (on by default, crates/victory-gpu/src/host/menu.rs:249) shows a strip at (0,0) of (len * CELL.0 + 2 * RIM) x (CELL.1 + 2 * RIM) times the scale — about 304x34 at 1080p. It is drawn from the menu's own buffers, which are the whole box: size (:843) is (60 * 6 + 2 * 4) * scale by (29 * 9 + 2 * 4) * scale, 736x538 at 1080p.

Buffers::new (:958) therefore makes four upload buffers and a card buffer of pitch * height = 2944 x 538 = 1,583,872 bytes each, painted (:921) fills all of it, Buffers::write copies all of it into an upload buffer, and Menu::draw (:2001) copies all of it to the card with CopyResource whenever the text changes — once a second, since fps_line formats {:.1}. CopyTextureRegion then takes the w x h corner out of that card. A 34-row corner is painted and copied to the card from a 538-row picture, 1,583,872 bytes a second at 1080p.

Buffers now carries the size of the picture it holds, and the menu keeps two: the box (index 0) and the frame-rate line's strip (index 1), sized as above with the same rim the box uses. Each is made once and kept, so closing and opening F1 remakes neither — a remake leaks the old set, as it already did for a resize, because a list may still copy from its card. The strip is grown and not shrunk when a rate gains a digit, so the numbers changing does not make new buffers; a longer line than any seen so far remakes it once.

What is copied onto the back buffer is the same region of the same pixels: the_frame_rate_lines_strip_is_the_boxes_first_rows asserts the strip is the box's first rows byte for byte. The F1 box's own buffer is untouched, and the strip's footprint and copy region come from its own size instead of size(scale).

The line's upload falls from 1,583,872 to 43,520 bytes a second for a 24-character line (304x34, pitch 1280).

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): none, no title run on this machine.
  • Before: 1,583,872 bytes painted and copied to the card each second, of which the copy onto the back buffer uses 304x34.
  • After: 43,520 bytes for a 24-character line (the arithmetic above, from size, CELL = (6, 9), RIM = 4 and the 256-byte pitch rounding in Buffers::new). Not measured on a card.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): none, no shader change.
  • cargo test passed for the crates it touches: yes for victory-gpu, with two failures that fail on 84bd61e2 as well — list::thin::tests::bindings_record_no_work and shader_cache::tests::every_switch_of_the_translator_is_in_the_key; the new the_frame_rate_lines_strip_is_the_boxes_first_rows passes. cargo check -p victory-gpu --locked passes.
  • CI: not run yet — the check job is action_required (a pull request from a fork waits for approval). cargo clippy -p victory-gpu --all-targets --locked reports the same two findings as on 84bd61e2 — Shadow::ranged never used and manual_is_multiple_of at host.rs:5092, neither in the files this changes (main's clippy gate is red; #4166 fixes it).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #3920 adds the 1% low to the FPS line in the same file (fps_line and its tests); it changes the text, not the buffers, and a longer line still fits (the strip grows). #3982 proposes a new look for the overlays from a fork and is not a pull request here; it keeps the same data.

AI use

Kam471, with OpenCode, model DeepSeek V4.1 Flash 1017.

**@⁠Kam471** on GitHub · 2026-11-30 18:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4283) `Kam471:fps-line-strip` → `main` · +851 −852 · 32 files · 11 commits · closed without merging ## What it changes With F1 closed, `VICTORY_FPS_LINE` (on by default, `crates/victory-gpu/src/host/menu.rs:249`) shows a strip at (0,0) of `(len * CELL.0 + 2 * RIM) x (CELL.1 + 2 * RIM)` times the scale — about 304x34 at 1080p. It is drawn from the menu's own buffers, which are the whole box: `size` (`:843`) is `(60 * 6 + 2 * 4) * scale` by `(29 * 9 + 2 * 4) * scale`, 736x538 at 1080p. `Buffers::new` (`:958`) therefore makes four upload buffers and a card buffer of `pitch * height` = 2944 x 538 = 1,583,872 bytes each, `painted` (`:921`) fills all of it, `Buffers::write` copies all of it into an upload buffer, and `Menu::draw` (`:2001`) copies all of it to the card with `CopyResource` whenever the text changes — once a second, since `fps_line` formats `{:.1}`. `CopyTextureRegion` then takes the `w x h` corner out of that card. A 34-row corner is painted and copied to the card from a 538-row picture, 1,583,872 bytes a second at 1080p. `Buffers` now carries the size of the picture it holds, and the menu keeps two: the box (index 0) and the frame-rate line's strip (index 1), sized as above with the same rim the box uses. Each is made once and kept, so closing and opening F1 remakes neither — a remake leaks the old set, as it already did for a resize, because a list may still copy from its card. The strip is grown and not shrunk when a rate gains a digit, so the numbers changing does not make new buffers; a longer line than any seen so far remakes it once. What is copied onto the back buffer is the same region of the same pixels: `the_frame_rate_lines_strip_is_the_boxes_first_rows` asserts the strip is the box's first rows byte for byte. The F1 box's own buffer is untouched, and the strip's footprint and copy region come from its own size instead of `size(scale)`. The line's upload falls from 1,583,872 to 43,520 bytes a second for a 24-character line (304x34, pitch 1280). ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): none, no title run on this machine. - Before: 1,583,872 bytes painted and copied to the card each second, of which the copy onto the back buffer uses 304x34. - After: 43,520 bytes for a 24-character line (the arithmetic above, from `size`, `CELL = (6, 9)`, `RIM = 4` and the 256-byte pitch rounding in `Buffers::new`). Not measured on a card. - For shader changes, the wave sizes tested (32 and/or 64 lanes): none, no shader change. - `cargo test` passed for the crates it touches: yes for `victory-gpu`, with two failures that fail on 84bd61e2 as well — `list::thin::tests::bindings_record_no_work` and `shader_cache::tests::every_switch_of_the_translator_is_in_the_key`; the new `the_frame_rate_lines_strip_is_the_boxes_first_rows` passes. `cargo check -p victory-gpu --locked` passes. - CI: not run yet — the `check` job is `action_required` (a pull request from a fork waits for approval). `cargo clippy -p victory-gpu --all-targets --locked` reports the same two findings as on 84bd61e2 — `Shadow::ranged` never used and `manual_is_multiple_of` at `host.rs:5092`, neither in the files this changes (main's clippy gate is red; #4166 fixes it). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #3920 adds the 1% low to the FPS line in the same file (`fps_line` and its tests); it changes the text, not the buffers, and a longer line still fits (the strip grows). #3982 proposes a new look for the overlays from a fork and is not a pull request here; it keeps the same data. ## AI use Kam471, with OpenCode, model `DeepSeek V4.1 Flash 1017`.
With F1 closed, the frame-rate line is drawn from the menu's own buffers: the
box's 736x538 at 1080p (`host/menu.rs` `size`, `CELL` and `RIM`), painted in
full by `painted` and copied to the card with `CopyResource` every time the
rate changes — once a second at `fps_line`'s `{:.1}` — to show the `{w}x{17}`
strip at (0,0) that `CopyTextureRegion` takes from its top left. 1,583,872
bytes a second of painting and card copy (pitch 2944 x 538 rows) for a
304x34 corner.

`Buffers` now carries the size of the picture it holds, and the menu keeps
two: the box, and the line's strip (`CELL.1 + 2 * RIM` rows, as wide as the
line and its rim). Each is made once and kept, so opening and closing F1
remakes neither, and the strip's is grown rather than remade when the rate
grows a digit. The box's own buffer is untouched, and what is copied onto the
back buffer is the same region of the same pixels: the strip is the box's
first rows byte for byte (`the_frame_rate_lines_strip_is_the_boxes_first_rows`).
The line's upload falls from 1,583,872 to 43,520 bytes a second for a
24-character line (1280 x 34).

Checked: `cargo check -p victory-gpu --locked`; `cargo test -p victory-gpu
--locked --lib` (1132 passed, and `list::thin::tests::bindings_record_no_work`
and `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` fail
on 84bd61e2 too).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:17:22 +00:00
github-bot closed this pull request 2026-12-01 18:50:15 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:44 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4283#issuecomment-7321458829) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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/trustno1-coder--VIctory-NVIDIA!4284
No description provided.