Make the mesh fallback's programs on up to four worker threads instead of one.

A place's task and mesh programs all arrive in its first frames, and each one's draws are left out until its compute
pipelines are built, so with one thread the foliage of a first visit filled in one program at a time.
NX2NAVI_MESH_FALLBACK_WORKERS (auto: one thread for each 4 logical processors, 1 to 4) sets how many threads make
them, and the log says how long the queue took to empty the first time.

Measured with the fallback forced on, no pipeline cache and new exe names (cold driver cache), the adult save's
first 75 s: with 1 worker the first 5 programs were ready after 420 ms, 3,266 draws were skipped while a pipeline or
program was pending, 1% low 16.1 fps and 145 frames over 50 ms; with 4 workers 256 ms, 956 draws, 55.7 fps and 35.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 18:43:38 -05:00
parent 677a69378f
commit 14fbc6a0ea
4 changed files with 38 additions and 6 deletions

View File

@@ -153,8 +153,10 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
a village frame's 45 mesh draws are 45 passes cut, 90 to 135 dispatches and about 270 barriers more than with mesh
shaders. The buffers (`mesh_fallback_mb`, 128 MiB) are reused by every draw, so they hold the largest draw, not
a frame; a draw that emits more loses what does not fit, and the log says how much it needed.
- A program's modules and compute pipelines are made on a thread of their own at its first draw, which is skipped
until they are ready; they are not recorded for the next start, where the pipeline cache makes them quick.
- A program's modules and compute pipelines are made by worker threads at its first draw, which is skipped until
they are ready (`mesh_fallback_workers`, auto: one for each 4 logical processors, 1 to 4, so a place's programs,
which all arrive in its first frames, are not made one after the other); they are not recorded for the next start,
where the pipeline cache makes them quick.
Not carried: the far shadow cascades' coarser shading rate, a draw's first workgroup other than 0, and more
workgroups in one draw than one compute dispatch may have.
- Pipelines: `VK_EXT_graphics_pipeline_library` where the driver has it: stage libraries compiled ahead, a fast link