feat(vk): FPS counter Breakdown in the graph: the frame's parts, the render thread's lane, the game's waits by cause #928
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!928
Loading…
Reference in a new issue
No description provided.
Delete branch "ballotstomper/Longshot:feat/fps-breakdown-lanes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: feat · Risk: low · Tested on: Linux, RX 6750 XT · Needs: Windows, any GPU
Why
The FPS counter's Breakdown level showed a single bar of Game / Renderer / GPU wait / Pacing beside the graph. It didn't say what the game was waiting on, it didn't show that the GPU and the render thread run in parallel with the frame, and with Threaded rendering on, the render thread (often the real limit) didn't show at all. When you're chasing a stutter or a low frame rate, you couldn't tell from the counter whether the game, the render thread or the GPU was holding the frame. The 1% low was also shown as a frame rate next to a frame time, so the two numbers didn't compare.
No issue asks for this. Related: #562 adds a System level after Dev to the same counter. It's a separate level, not an overlap, but both change
draw_fps,fps_stats.hand the language counts ingpu/vk/menu_i18n.h, so whichever lands second redoes those lines.What changed
The Breakdown now draws each frame's parts stacked in the graph's own columns, so you can see over the last 4 seconds where each frame's time went. The waits are split by what the game was waiting on. With Threaded rendering on, a lane under the graph shows the render thread's own frame on the same scale. Dev also shows the CPU, GPU and driver, so screenshots and recordings say what they ran on.
gpu/vk/vk_fps.cpp/.h,gpu/vk/fps_stats.hFpsFenceWaitinwait()(gpu/vk/vk_replay.cpp) sorts a game fence wait by whether its work was already recorded. Recorded work is a wait on the GPU; unrecorded work is a wait on the render thread. A fence wait on another thread is carved out of Game.FpsRtWaittimes the render thread: recording, waiting for the parallel replay's workers, waiting for a GPU slot, and idle. It only runs on the render thread, and only at the Breakdown level.columns()uses fixed time slots and returns a sub-slot scroll, so the graph moves smoothly instead of jumping a column at a time.draw_fpsingpu/vk/vk_menu.cppbug_report::cpu_name(), the cpuid code the bug report already used, now its own function), the GPU (device_name_text()) and the driver (driver_text()). The CPU and GPU names drop their (R)/(TM) marks, clock speed, core count and a trailing driver note in brackets. A line too long for the column is cut with "...".gpu/vk/menu_i18n.h).tests/test_fps_stats.cppexpects the new 1% low text.Measurements
Verdict: no cost with the counter off. At Breakdown, the PR is within run-to-run noise of main's Breakdown (≤ 1 fps a segment). A profiled run puts the whole counter, drawing included, at 0.01% of samples.
Hardware: Arch Linux (kernel 7.3.4), RX 6750 XT 12 GB, Mesa 26.2.7 (RADV), Ryzen 5 5600X, 16 GB
Scene: Castle Town Market at noon as a child (the crowd), 2560x1440 output, fixed render resolution, no upscaler or frame generation, Uncapped, V-Sync off
Method: a scripted run in game frames (each run goes through the same game states frame for frame): stand 6 s, camera turned right and back 8 s, walk 8 s of game time. The FPS counter was Off (
fps_counter=0) or at Breakdown (fps_counter=4). Main and the PR were interleaved after a warm-up run: main, PR, main, PR, with the game rebuilt before each build's runs. Each segment's fps, 2 runs each (the mean of the two).How to reproduce: a scripted runner on the game's control bridge (
HOS_CONTROL): teleport to the market at noon, then the steps above, with the counter level set inlongshot_options.inibefore each run.The PR column was measured at 8136d7f7. After it, the PR changed only text (help, labels, README), the Dev level's three lines, and a rebase onto the new main. None of that runs below the Dev level.
f637b42d, counter Offf637b42d, BreakdownThe PR's second counter-off run doesn't count: it sat on a loading screen at an uncapped ~230 fps and never reached the market ("FAILED teleport" below).
Flags and settings
No switch, ini key or build flag is added. One menu row changes what its levels show; its values, default and key stay the same.
fps_counter=)Testing
Tested:
python -I -B tests/run_all.py: 536 passed, 18 failed, 75 skipped. The failures aretest_appimage_player_build,test_bake_portability,test_crash_dialog,test_crash_record,test_crt_options,test_env_on,test_lift_cleanup_error,test_linux_preflight,test_linux_update,test_make_game_cache,test_missing_nup,test_mods_size_table,test_options_budget_once,test_pipeline_tour,test_readback_late,test_vk_occlusion_queries,test_vk_pgoandtest_walk_key.test_readback_lateandtest_vk_occlusion_queriesread files this PR changes, so I ran them on main's tree too: same failures.test_crash_recordpasses when run alone; its forced-kill timing cases fail only in the parallel full run.Not tested:
Must be tested:
Risks
What could break: the FPS counter's drawing at Breakdown and Dev: a legend running past the column, or a lane on the wrong scale. The measuring adds a clock read around fence waits and the render thread's waits, only at the Breakdown level and above. The new legend labels are untranslated in the other 12 languages.
Turning it off: set the FPS counter below Breakdown, or revert the commit.
Compatibility: Nothing changes: no new options-file key, no cache or ABI change.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
tests/that reads changed source updated in this PR, not weakened.Tested in game: RX 6750 XT, Mesa 26.2.7, Arch Linux: every FPS counter level with Threaded rendering on and off. The stacked graph, the legend and the render-thread lane (only with threading on) looked correct, and the CPU/GPU/driver lines showed only at Dev.
Screenshots, Linux, RX 6750 XT, Breakdown level. These are from before the last changes: the after shots still read "Submit", now "Renderer" again, and don't show the Dev lines. New ones of the final build will follow.
Before: main, Breakdown

After: this PR, Breakdown, Threaded rendering off (no render-thread lane)

After: this PR, Breakdown, Threaded rendering on (the render-thread lane under the graph)

The final build (
2db129e0) at the Dev level, Linux, RX 6750 XT, Threaded rendering on: the CPU, GPU and driver lines under the frame time, "Renderer" back in the legend, the render-thread lane under the graph.Description: the screenshot box now notes the Dev screenshot of the final build; a matching Breakdown pair at the same spot is still to come.
WIP: feat(vk): FPS counter Breakdown in the graph: the frame's parts, the render thread's lane, the game's waits by causeto feat(vk): FPS counter Breakdown in the graph: the frame's parts, the render thread's lane, the game's waits by cause