Commit Graph

1 Commits

Author SHA1 Message Date
8d25334d12 runtime: PSOs made on worker threads, a per-frame wait budget, the early list
Ported from VIctory's pipeline/make.rs and pipeline/library.rs (GPL-3.0-or-later, Marvisak and
contributors, DexNom fork). The title creates ~60,000 PSOs in its first 20 s; compiled at creation,
its first CreateComputePipelineState held the main thread until the title's 30 s hang detector fired.

- Creation checks the description and the translator's index (program hash and entry, bindless,
  mesh limits, code base, workgroup memory, the module file) and returns. The module, the layout and
  the pipeline are made by a worker (src/pipeline_queue.h: half the logical processors, 2 to 8,
  below normal priority). The SPIR-V is read at creation only where a check on it could refuse the
  PSO on this device; the game's index lists the capabilities, so on the RTX 4060 Ti no module is
  read at creation.
- SetPipelineState starts the build and waits while the frame's budget lasts
  (LEONIDA_PIPELINE_WAIT_MS, 500 per frame and kind, one window the threads share, never for a
  pipeline held over 3 s / 10 s). A draw, mesh draw, dispatch or indirect dispatch recorded without
  a made pipeline is dropped and counted, logged once a second; the list stays valid. Frames are the
  console frame clock's (slot 80); the title's device is bounded from its creation. A device of no
  title (PC interface, tests) waits for the build until a frame begins, so nothing drops there.
- The early list: keys of the PSOs a run bound, in early-pipelines.txt beside pipeline_cache.bin
  (or LEONIDA_EARLY_PIPELINES), started at creation on the next run, depth-only first.
- The title's device reads the 57 MB index on a thread from its creation (about 3.5 s).

Tests: pipeline_queue_test (no GPU: the frame window, queue order, a retired job, drops, the early
list's file) and d3d12_async_pipeline_test (RTX 4060 Ti: 192 PSOs created in ~15 ms, all draws
dropped and counted while held, all drawn once made; the early list written and read back; console
slot 86 makes the stream PSO). vk_pipeline_paths measures monolithic, pipeline-library and
shader-object compiles of translated pixel shaders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 21:55:47 -05:00