Commit Graph

3 Commits

Author SHA1 Message Date
d42c37335b d3d12: LEONIDA_ASYNC_MIN_BYTES_GRAPHICS, a separate async threshold for graphics (RT-ASYNC-MIN-BYTES-GRAPHICS)
With LEONIDA_ASYNC_PIPELINES=1, graphics and mesh pipelines (all their stages) now take
LEONIDA_ASYNC_MIN_BYTES_GRAPHICS when it is set, and LEONIDA_ASYNC_MIN_BYTES otherwise, so
nothing changes while it is unset. Compute keeps LEONIDA_ASYNC_MIN_BYTES. 0 makes every graphics
pipeline asynchronous. One startup line states both thresholds; text that is not a number is
ignored with a log line.

Thread dumps from a retail run showed the draw thread building lazy graphics variants under the
1 MiB threshold in place, 2.5-11 s each, back to back, with no present for about 100 s. A skipped
draw costs one draw. The image needs the small lighting and post compute programs, and those
are still built in place.

Tests: async_pipeline_size_test covers the per-kind decision and the unset fallback;
d3d12_pipeline_workers_test --async-graphics-zero / --async-graphics-unset (new ctests) hold
the compile worker with compute over its threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:24:29 +01:00
6f2b52e563 d3d12: prewarm console streams kept for their first bind (on-demand)
With LEONIDA_PIPELINE_COMPILE=on-demand a console stream (device slot 86) is
only parsed when it is first bound, and create_graphics queued the prewarm
from there, so a planned pipeline got no lead at all. ecox982745 measured 0
of 8 planned builds before the first bind in that mode, 8 of 8 otherwise.

When the plan has the stream's pipeline, the parse is now queued as its first
prewarm job (at the rank of its first recorded variant, on a compile worker);
create_graphics then queues the variants as for any other PSO. A bind that
comes first waits for the parse through resolve_type's call_once, as it would
have parsed it itself.

d3d12_pipeline_workers_test gets a device case: a first device records the
order, then console-stream PSOs with an eight-entry plan must build those
eight before any command is recorded, with the ordinary stream and with
on-demand, and nothing without a plan. Without the fix the on-demand case
fails with 0 of 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 06:00:01 -06:00
3e1c49e1bd d3d12: compile a submission's pipelines on worker threads (RT-PIPELINE-COMPILE-WORKERS)
prepare() leaves the pipelines that are not built yet to PipelineCompiles, once per pipeline and variant. VulkanQueue::execute_now compiles them together on the device's workers with the resource lock held, places them in the prepared commands and then writes the command buffer, so every draw and dispatch has its own pipeline. A refused compile gives the result prepare() alone would have given. LEONIDA_PIPELINE_THREADS=0 keeps the path of before. Graphics pipelines of 1 MiB of SPIR-V or more and compute pipelines over 128 KiB compile one after another, and LEONIDA_ASYNC_PIPELINES keeps its own worker.
2026-11-25 04:46:33 +01:00