Repository navigation
GPU: a debug overlay, Alt+Z, drawn into the presented frame - #2171
Draft
0xkn0wh3r3 wants to merge 4 commits into
Draft
0xkn0wh3r3 wants to merge 4 commits into
0xkn0wh3r3 wants to merge 4 commits into
Conversation
DenRakEiw
approved these changes
Nov 25, 2026
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib overlay::— 4 passed, 0 failed (1 ignored) on RTX 5090cargo clippy -p victory-gpu -p victory-hle --all-targets— 0 warningscargo xtask policy— ok (184 files ok)
Clean Alt+Z in-frame debug overlay implementation with unit tests and zero clippy warnings across victory-gpu and victory-hle. Looks good.
AI-assisted (Gemini 4 Neon).
catminou4
reviewed
Nov 25, 2026
catminou4
left a comment
Contributor
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Debug overlay (Alt+Z) drawn into presented frame — debug UI; mixed gpu+hle, Windows-only.
0xkn0wh3r3
marked this pull request as draft
November 25, 2026 07:23
Contributor
Author
|
Moving this back to draft. There is a lot more I want to add and I found some bugs with how it interacts with in-game controls. |
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory
that referenced
this pull request
Nov 25, 2026
…oggles work during slow frames
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory
that referenced
this pull request
Nov 25, 2026
… frame) into demo
Alt+Z, while our window has focus, shows and hides a panel in the top left corner of each presented frame (`VICTORY_OVERLAY=0` turns it off, `VICTORY_OVERLAY=1` shows it from the start): - frame rate and frame time over the last 240 frames, the 1% low, and a graph of the frame times with the 30 fps line; - the presenter's last second per frame: draws, time preparing submissions and waiting for the GPU (`Meter`); - the process's CPU use (`GetProcessTimes` against the processors), its private and in-use memory, the machine's memory, and video memory against its budget and shared memory (`QueryVideoMemoryInfo` on the device's adapter), sampled once a second while it shows; - the controller as the title reads it (sticks, triggers, buttons; the keyboard's stand-in pad where none is connected), published by `gameinput`; - toggles, keys 1-4 while it shows, that leave out compute dispatches, mesh draws, vertex draws or indirect execution (logged when changed), to see what draws what. While it shows, the title reads neutral pads and no keys. It is drawn on the CPU, our own 5x7 font, into upload memory in the back buffer's format (the four the presenter makes: RGBA8, BGRA8, RGB10A2 and RGBA16F), redrawn at most every 250 ms and copied into the back buffer after the frame, before the present: no shaders or pipelines, and nothing while it is hidden but a frame time and a key poll. Tests: the panel's lines fit and every character has a glyph; the frame rate and 1% low; colours per format; on the host GPU, a shown panel copied into a 640x400 back buffer lands at the margin with its text, the rest untouched. An ignored test (`preview`) writes a sample panel to the BMP file `VICTORY_OVERLAY_PREVIEW` names.
The keys were looked at once per presented frame. A world frame takes a second or more, so Alt+Z or 1-4 pressed and let go between two frames was never seen, and the toggles seemed blocked exactly when they are needed. A thread now looks at them every 15 ms and flips the switches; the presenter only redraws the panel when one changed. If the thread cannot start, the presenter reads the keys once a frame, as before.
0xkn0wh3r3
force-pushed
the
tools/overlay
branch
from
November 25, 2026 22:19
a5f18f9 to
fe04987
Compare
The panel was a 5x7 bitmap font in capitals with an unlabelled bar graph. It is now easier to read and says what each number and graph is: - Text is Consolas, antialiased in grey, drawn through GDI into a coverage mask and blended over the panel (the 5x7 font stands in where GDI makes no device context). Mixed case, with units on every value. - The panel scales with the back buffer: 1 at 1080 lines, 0.75 at 720, up to 2 at 2160 (it was 1, 2 or 3 by whole steps). - Sections with headers: performance, system, controller, draw toggles; labels left, values right-aligned. - Frame time graph: a titled y axis in ms (0, 16.7, 33.3, 50, 66.7+), gridlines named 60, 30 and 20 FPS, an x axis from 240 frames ago to now with ticks and a caption, bars coloured by threshold. - A new graph: CPU use and video memory used of its budget, percent, over the last 60 s (a sample a second), with a legend and labelled axes. - The controller drawn: a box per stick with its position, bars for the triggers, and the buttons lit while held. - The toggles as check boxes, each saying whether its work is drawn or left out. Tests: frame statistics; the panel fits 720, 1080 and 2160 lines in either font and draws each colour; GDI text is antialiased; coverage blending; colours per format; the GPU copy test now at 1920x1080 checks the panel's border at the margin and text inside it. The ignored `preview` test writes the panel at 1080 and 1440 lines.
- GPU busy time: while the overlay shows, each host submission runs between two small lists that write a timestamp each, the second resolving both into a read-back buffer (`overlay::time_lists`, `time_read`, around `ExecuteCommandLists` in `Host::execute`; every submission is waited for, so the timestamps are read right after). The frame's submissions add up to its GPU busy time, shown per frame and as a share of the frame time, and as a third line (GPU busy, %) in the 60 s graph. Hidden, nothing is timed. - Input to present: from the title's first input read of a frame (GameInput's current reading, `overlay::note_input_read`) to the present that ends it; the mean and slowest of the last 60 frames that read input. It does not include the display's own latency. Tests: the busy percent is over the last second of frames and the recent mean and slowest skip frames not measured; the GPU copy test now keeps the panel shown through its submission and checks GPU time was measured on the host GPU.
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory
that referenced
this pull request
Nov 26, 2026
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory
that referenced
this pull request
Nov 26, 2026
101Leafy
pushed a commit
to 101Leafy/victory-leafy
that referenced
this pull request
Nov 26, 2026
… 0xkn0wh3r3) Ported from 0xkn0wh3r3/VIctory tools/overlay (Marvisak#2171). A panel drawn on the CPU into upload memory and copied into the back buffer's corner before the present: frame rate, frame-time graph, draws and submission times, GPU busy time, input to present, process CPU and memory, video memory, a 60-second graph, the controller the title reads, and keys 1-4 to leave out compute, mesh, vertex or indirect work. VICTORY_OVERLAY=1 shows it from the start, VICTORY_OVERLAY=0 turns it off. Differences from the VIctory branch, for this tree: - host.rs: one present path here (no compositor), so the panel's copy is recorded once, after the frame's copy. While the panel shows, the present is not sent ahead (late_free_present), since the panel's upload buffer is rewritten between presents. - list.rs: DispatchX is gated with the other compute dispatches. - gameinput.rs: the pad shown is the one the title reads after the keyboard and mouse controls are merged (State::publish); while the panel shows, pads read neutral and the keyboard device reads no keys. - Cargo.toml needs no change: Win32_UI_Input_KeyboardAndMouse is already on.
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory-Belobug-AMD
that referenced
this pull request
Nov 27, 2026
Ported from 101Leafy/victory-leafy#14 (0xkn0wh3r3/VIctory tools/overlay-leafy @ fa688e7a, itself a port of Marvisak/VIctory#2171). overlay.rs is taken unchanged. A panel drawn on the CPU into upload memory and copied into the back buffer's corner before the present: frame rate, 1% low, a frame-time graph, draws per frame, time preparing submissions and waiting for the GPU, GPU busy time (timestamps around each host submission while it shows), input to present, process CPU and memory, video memory against its budget, a 60-second graph, and the controller the title reads. The title keeps its input while it shows. VICTORY_OVERLAY=1 shows it from the start, VICTORY_OVERLAY=0 turns it off. It sits beside this tree's F3 panel (VICTORY_PANEL) and does not share its key. Differences for this tree: - host.rs: the panel's copy is recorded after the frame reaches the back buffer on both paths, the plain copy and the two-plane compose (back is in COPY_DEST either way), right after the F3 panel's. - gameinput.rs: State::poll has no merged value table here, so the pad shown is the merged pad with one pad, else the first connected pad, else the keyboard and mouse stand-in.
0xkn0wh3r3
added a commit
to 0xkn0wh3r3/VIctory-Belobug-AMD
that referenced
this pull request
Nov 27, 2026
Ported from 101Leafy/victory-leafy#14 (0xkn0wh3r3/VIctory tools/overlay-leafy @ fa688e7a, itself a port of Marvisak/VIctory#2171). overlay.rs is taken unchanged. A panel drawn on the CPU into upload memory and copied into the back buffer's corner before the present: frame rate, 1% low, a frame-time graph, draws per frame, time preparing submissions and waiting for the GPU, GPU busy time (timestamps around each host submission while it shows), input to present, process CPU and memory, video memory against its budget, a 60-second graph, and the controller the title reads. The title keeps its input while it shows. VICTORY_OVERLAY=1 shows it from the start, VICTORY_OVERLAY=0 turns it off. It sits beside this tree's F3 panel (VICTORY_PANEL) and does not share its key. Differences for this tree: - host.rs: the panel's copy is recorded after the frame reaches the back buffer on both paths, the plain copy and the two-plane compose (back is in COPY_DEST either way), right after the F3 panel's. - gameinput.rs: State::poll has no merged value table here, so the pad shown is the merged pad with one pad, else the first connected pad, else the keyboard and mouse stand-in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A small debug overlay drawn into each presented frame, toggled with Alt+Z.
The panel at 1080 lines, as the ignored
previewtest renders it from sample data (compute left out, A and RB held). It has not been captured from a running title. At 1440 lines: overlay-1440.png.What it shows
Four sections, each with a header; labels on the left, values right-aligned with their units.
Metersecond: draws per frame, time preparing submissions, and time waiting for the GPU;GetProcessTimesagainst the processor count);QueryVideoMemoryInfoon the device's adapter);gameinput(the keyboard's stand-in pad when none is connected): a box per stick with its position, bars for the triggers, and the buttons lit while held.While the panel shows, the title reads neutral pads and no keys.
Switches
VICTORY_OVERLAY=1shows it from the start;VICTORY_OVERLAY=0turns it off.How it is drawn
On the CPU, into upload memory in the back buffer's format (RGBA8, BGRA8, RGB10A2 or RGBA16F, the four the presenter makes), then copied into the back buffer's corner after the frame, before the present, with one
CopyTextureRegion.Relation to #130
#130 is the full opt-in profiler (CSV, Perfetto trace, and a panel behind F3). This one is smaller and independent: a live panel with controller input and work toggles, and no new crate. If #130 lands first, this panel could take its numbers instead.
Changes
crates/victory-gpu/src/overlay.rs(new): the panel, its drawing, the keys, and the submission timer;host.rs: the presenter records the panel's copy,Meterhands over its second, andHost::executesubmits through the timer while the panel shows;list.rs: the four toggle gates at the draw, dispatch, mesh and indirect entry points;victory-hlegameinput.rs: publishes the pad, notes the title's input reads, and gives the title neutral input while the panel shows;Win32_UI_Input_KeyboardAndMousefeature forvictory-gpu.Testing
overlay::tests(9):cargo test --workspace --exclude victory-shader: 571 passed. The only failures are the 2 known NVIDIA heap-limit tests (NVIDIA D3D12 (70564ae): stride_tests & synthetic_tests fail due to HEAP_VIEWS (2M > 1M NVIDIA limit) and Stride::Structured with rawBufferLoad #1835), which fail the same way onmain.cargo clippy --workspace --all-targets, with and without--features diagnostics: clean.Rebased onto f3578e3
Overlay::recordnow takes the back buffer's state and returns the state it leaves it in, so the composited path moves the back buffer to the copy destination only when the panel is copied.State::poll: the overlay's pad and input capture now run insideState::poll, after both, so the panel shows the pad the title actually reads.cargo test -p victory-gpu --lib: all pass but the two known NVIDIA heap-cap tests;overlay::testsandgameinputtests pass.host::present_plane_tests::compositor_failure_presents_primary_in_the_same_frame(--features diagnostics) exits abnormally here onmainas well. Clippy clean forvictory-gpuandvictory-hle, with and without--features diagnostics.