On-screen overlay of where the frame goes (F3), logged to overlay.log #717

Open
github-bot wants to merge 13 commits from github-bot/gh-717 into main AGit
Owner

@⁠abilliontokens on GitHub · 2026-11-25 05:27 UTC · original
abilliontokens:tools/overlay → main · +2081 −70 · 18 files · 13 commits · open

Stacked on #687 (itself stacked on #617): the first eight commits are those PRs'. This PR's own commits are the last four. It merges cleanly into the current main (310c6eb).

What

An on-screen panel of where the frame goes, in every build, shown from the start. F3 hides or shows it while the title's window has the focus; VICTORY_OVERLAY=0 starts with it hidden.

Once a second it shows:

  • the card, window size, uptime, frame number
  • fps, ms/frame, and the last 240 frames' median, 95th percentile, worst and the number over twice the median
  • preparing (copies, texture refreshes and what they waited for), GPU (card busy %, idle behind us), copy-back (and MB the CPU compared looking for shader writes), the heap passes draws make in the title's recording threads; the largest is named the bottleneck
  • waiting for the card, sent-ahead settles, how long the submitting thread waited for the title to submit
  • processor use of the process
  • draws, dropped (top five reasons in a diagnostics build), indirect, mesh groups
  • pipelines being made, made, loaded from the library; slow driver compiles (count, total, slowest, the last one's shaders, from #687's slow compile log)
  • textures picked by index (uploaded, waiting, passed over) and their queue census
  • title buffer copies, depth twin copies, card copies sent up
  • process memory, video memory against budget, shared memory
  • a bar per frame for the last frames' times (green to 34 ms, yellow to 100 ms, red above, a grey line at 33 ms; the scale stops at four times the median, so one stall of seconds does not flatten the rest)

Each second's panel is also appended to overlay.log in the cache folder, shown or hidden (VICTORY_OVERLAY_LOG=<file> elsewhere, 0 for none). scripts/bench.ps1 puts it in the run's folder.

How

The figures are the ones the frame-rate line already takes each second (Meter::frame); card_clock_line, late_line and shadow::back_line now also return what they log. The text is drawn with GDI into a bitmap once a second. Each present writes the panel into an upload buffer of its own (one per present list, so a present still in the air keeps its buffer) and copies it onto the back buffer with CopyTextureRegion after the frame's CopyResource. No pipeline or shader. Saved frames (VICTORY_CAPTURE) read the source texture, so the panel is not in them. R8G8B8A8, B8G8R8A8, R10G10B10A2 and R16G16B16A16_FLOAT back buffers are handled. Other formats show no panel.

Checked

  • cargo build of victory-gpu with and without diagnostics; cargo test -p victory-gpu --lib 114 passed
  • one unit test: panel pixels in each back buffer format's layout
  • live, RTX 5060 Ti, 3840x2160 window, prologue: panel drawn from the first present (overlay drawn width=1428 height=620 format=28 in the log); overlay.log written each second
  • no frame-time change I could measure against runs without it (bench medians moved more between runs than the panel costs)
**@⁠abilliontokens** on GitHub · 2026-11-25 05:27 UTC · [original](https://github.com/fxceless/victory-fork/pull/717) `abilliontokens:tools/overlay` → `main` · +2081 −70 · 18 files · 13 commits · open Stacked on #687 (itself stacked on #617): the first eight commits are those PRs'. This PR's own commits are the last four. It merges cleanly into the current main (310c6eb). ## What An on-screen panel of where the frame goes, in every build, shown from the start. F3 hides or shows it while the title's window has the focus; `VICTORY_OVERLAY=0` starts with it hidden. Once a second it shows: - the card, window size, uptime, frame number - fps, ms/frame, and the last 240 frames' median, 95th percentile, worst and the number over twice the median - preparing (copies, texture refreshes and what they waited for), GPU (card busy %, idle behind us), copy-back (and MB the CPU compared looking for shader writes), the heap passes draws make in the title's recording threads; the largest is named the bottleneck - waiting for the card, sent-ahead settles, how long the submitting thread waited for the title to submit - processor use of the process - draws, dropped (top five reasons in a diagnostics build), indirect, mesh groups - pipelines being made, made, loaded from the library; slow driver compiles (count, total, slowest, the last one's shaders, from #687's slow compile log) - textures picked by index (uploaded, waiting, passed over) and their queue census - title buffer copies, depth twin copies, card copies sent up - process memory, video memory against budget, shared memory - a bar per frame for the last frames' times (green to 34 ms, yellow to 100 ms, red above, a grey line at 33 ms; the scale stops at four times the median, so one stall of seconds does not flatten the rest) Each second's panel is also appended to `overlay.log` in the cache folder, shown or hidden (`VICTORY_OVERLAY_LOG=<file>` elsewhere, `0` for none). `scripts/bench.ps1` puts it in the run's folder. ## How The figures are the ones the frame-rate line already takes each second (`Meter::frame`); `card_clock_line`, `late_line` and `shadow::back_line` now also return what they log. The text is drawn with GDI into a bitmap once a second. Each present writes the panel into an upload buffer of its own (one per present list, so a present still in the air keeps its buffer) and copies it onto the back buffer with `CopyTextureRegion` after the frame's `CopyResource`. No pipeline or shader. Saved frames (`VICTORY_CAPTURE`) read the source texture, so the panel is not in them. R8G8B8A8, B8G8R8A8, R10G10B10A2 and R16G16B16A16_FLOAT back buffers are handled. Other formats show no panel. ## Checked - `cargo build` of victory-gpu with and without `diagnostics`; `cargo test -p victory-gpu --lib` 114 passed - one unit test: panel pixels in each back buffer format's layout - live, RTX 5060 Ti, 3840x2160 window, prologue: panel drawn from the first present (`overlay drawn width=1428 height=620 format=28` in the log); overlay.log written each second - no frame-time change I could measure against runs without it (bench medians moved more between runs than the panel costs)
- scripts/bench.ps1 starts the diagnostics build, drives the menus into
  the world from what each captured frame shows (the legal notices' Next,
  the terms' two boxes and Confirm are recognised by their layout; A on
  every other screen), measures a window of world frames and writes
  summary.md / summary.json beside the log and periodic frames. Each run
  starts from a copy of the data folder, so runs load the same save;
  -FirstBoot starts from no saves at all, -Compare tabulates runs, -From
  summarises an earlier run again.
- VICTORY_KEYS_FILE: keys appended to a file as lines are pressed in
  order, 0.6 s apart (the title's menus drop quicker presses), focus or not.
- VICTORY_CAPTURE: a file named `now` in the folder saves the next frame.
- Checked on an RTX 5060 Ti: from an empty data folder to the world in 98 s
  with no input by hand.
- `powershell -File` passes every argument as a string, so a hashtable
  literal could not reach the script from cmd or another shell.
- On an RTX 5060 Ti (driver 621.24) the second launch still made 163
  pipelines; 24 of them took the driver 2-128 s each (313 s of worker
  time), 20 of them compute. Their draws stay dropped all that while and
  each holds a pipeline worker, which the frame line only shows as a
  'being made' count. The log now names each one with its time.
- `cs,ms,vs,ps,gs`: only programs of those stages get the module passes;
  unset, every stage as before. The shader cache keys on it.
- A bisect of a clean-up fault in pixel shaders (#310) otherwise makes
  every compute pipeline again, and on an RTX 5060 Ti some of those take
  the driver 2-128 s each.
- A copy of the build outside target\ lets a run go on while the tree
  builds, or two builds be compared; the process is found by that
  build's own name.
- VICTORY_DEBUG_NULL_VIEWS=1: 2D texture slots that would read zeros read a
  magenta checkerboard where the title made a view the host has no texture
  for, a cyan one where there is no view; black left is the title's own.
- VICTORY_PIX=<dir>: the installed PIX's WinPixGpuCapturer.dll is loaded
  before the host device; a file named `capture` in the folder saves the
  next frames as frame-<n>.wpix.
- scripts/bench.ps1 -PixAt <s>: a PIX capture that many seconds into the
  world; summaries total the driver compiles of 2 s or more.
- README: the new switches, VICTORY_SHADER_OPT(_STAGES), and what the
  debug layer needs installed.
- With PIX's capturer loaded the runtime rejected the saved library, and the
  run then saved PIX's own (848 bytes) over it: a 426 MB library was lost
  and the next run made every pipeline again. Under VICTORY_PIX no library
  is opened or saved.
- scripts/bench.ps1: with -Victory the summary's build is that file and its
  time, not the tree's HEAD.
- `waits_end_on_ticks_and_count_frames` failed with flips 7 ticks apart
  ([21, 28, 35, 42]) while a shader translation ran beside `cargo test`:
  a loaded Windows machine wakes a 5 ms sleep up to a timer period late,
  past the next tick. At 50 ms it passed under 8 busy threads and a
  running title.
- fps and ms/frame; preparing (copies, textures), GPU and copy-back ms with the largest named the bottleneck
- card busy %, idle behind us, waiting for the card; draws, dropped (top reasons in diagnostics builds), indirect
- pipelines being made, slow driver compiles (count, total, slowest, last), textures picked by index waiting
- process and video memory; a bar graph of the last 240 frame times
- GDI text drawn once a second into a bitmap, copied per present from an upload buffer per present list onto the back buffer (no shader); saved frames read the source texture and are unaffected
- VICTORY_OVERLAY=0 starts with it hidden
- header: card, window size, uptime, frame; last 240 frames' median, 95th percentile, worst, hitches; graph capped at four times the median
- heap passes in the title's recording threads and title memory remapping as their own rows; heap passes can be named the bottleneck
- texture refresh waits, CPU scan of shader writes, sent-ahead settles, how long the submitting thread waited for the title
- processor use, mesh groups, pipelines made/loaded, texture queue census, title buffer copies, depth twin copies, card copies, shared memory
- each second's panel appended to overlay.log in the cache folder (VICTORY_OVERLAY_LOG=<file>, 0 for none)
- HEAP_PASS_PARTS: microseconds of each part, and the MB of spans refreshed (and of them in copies not write-watched)
- prologue on an RTX 5060 Ti: passes of 1.1-2.2 s are mostly textures picked by index (up to 1.5 s) and, every 16th pass, buffer views (up to 1 s)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:49:35 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/capture.rs
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/lib.rs
  • crates/victory-gpu/src/pipeline.rs
  • crates/victory-gpu/src/pipeline/library.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-717'
git switch 'github-bot/gh-717'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-717'
git switch 'github-bot/gh-717'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-717'
git switch 'main'
git merge --squash 'github-bot/gh-717'
git switch 'main'
git merge --ff-only 'github-bot/gh-717'
git switch 'main'
git merge 'github-bot/gh-717'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.