Build steps, each with a gate

  1. Measure what form A would leave serial: a timer around the lookups of each phase. Gate: if the lookups are more than about 75% of a draw, form A can't pass about 25%, and only form B is worth building. Measured (all timers on, about 1,460 ns a draw): the lookups are about 910 ns (62%): the resolve 386, vertex buffers 138, storage 94, cb_get 104, the texture lookups 33, the stage sets' storage 38, the indices about 94, the pass's begin 21. The encoding is about 510 ns (35%): the binds and record 263, desc_set_cached 56, the constants' windows and writes about 90, the textures' descriptors and target checks about 51, the images and the rest of the set about 50. The gate passes: form A's ceiling is about a third of a draw, less the copy of each draw's lookups to its worker.
  2. One worker, form A: the encoding of whole batches into a list, the replay in order. Gate: lists equal to the renderer's own (a check mode, as draw_state_check), and no loss against today.
  3. The per-worker state: the memos, the staging arena, the statistics, moved out of globals into a context that each draw gets (today they are globals of render.c).
  4. The shared caches, one at a time, with their rules and a stress test in tests/: the draw table, the surface table, the texture memo, the buffer cache, the descriptor set cache, the pipeline cache.
  5. Form B with one worker, then two and three. Gate at each: draw_state_check=1 reports no difference, and an A/B of at least three runs of 100 s a side shows the renderer thread's time a present.
  6. The dependency check, and the stats line: batches given, run, discarded and set up again.

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