The renderer thread sets the frame rate. It runs about 11,800 records a present in about 11 ms. The draws take 10.1 ms
of that: about 6,840 a present at about 1.47 us each. Records that are not draws take about 1.3 ms, constant buffer
writes 0.5 ms of it. The path around a draw (the record's state, vk_lock, the call) takes about 100 ns of a draw.
render_draw_main takes about 1.37 us a draw, in many steps:
| Phase | ns a draw |
|---|---|
| The resolve (draw table, targets, fragment key, textures, pipeline key) | 360 |
| Vertex buffers | 133 |
| Storage | 87 |
| Stage sets: constants 96, storage 19, textures 33, images and the set 43, two a draw | 414 |
| Indices and the pass | 117 |
| Binds 68, vertex input and dynamic state 96, push constants 42, the draw 19, commits 30 | 255 |
Six small changes measured no gain, and part D (buffers by address, device-generated commands, textures on the GPU) measured or estimated 2% to 4% net. The per-draw work stays. The only change that removes the bottleneck is to set up draws on more than one thread.
A per-draw pipeline (draw_prep, two threads in lock step) lost 15%: a hand-off and a wait at each draw (about 400 ns),
and the memos' cache lines that moved between two cores (the renderer's own draws got about twice as slow).
Made from docs/dev/parallel-draw-batches.md at 69237645142c. GPL-3.0-or-later.