The problem

In that world the renderer thread sets the frame rate. At about 84 fps a present takes 11.95 ms, and the renderer thread runs its records for 10.8 ms of it. The front end is busy 4.0 ms, the recording thread about 2.4 ms, and the busiest game thread 1.6 ms. The renderer prepares about 6,850 draws a present at about 1.6 us each, almost all of it in render_draw_main (src/nx/gpu/vk/render.c).

The time of a draw is spread over many steps:

Phase of render_draw_mainShare
Stage sets (stage_set_)34%
Binds and push constants15%
Targets, capture and fragment key12%
Buffer prefetch9%
draw_find and shaders8%
Storage and images6%
Start, formats and draw key, pipeline and setup, record3% to 4% each

Two smaller changes were measured and dropped. A stage set kept from the stage's last draw kept 67% of the stage sets, but its key cost about what it saved (net about 2% of the thread). Static buffers for the large stack frames gave no gain.


Made from docs/dev/draw-fast-path.md at 69237645142c. GPL-3.0-or-later.