vk_pipeline_get_deferred keeps its contract: it gives a pipeline or a stand-in, and the recording thread waits for a
stand-in at its bind. Inside it, a new Pipe on the GPL path goes this way:
vk_pipe_split gives the four keys. Each key finds its entry, or adds one.prewarm) moves to the draws' queue, as pipe_promote does now.VkPipelineLibraryCreateInfoKHR, with no
LINK_TIME_OPTIMIZATION flag. This is the fast link. It sets Pipe.fast and the ready flag.PIPE_OPT_PRESENTS (3) presents, the optimized pipeline goes on a third queue, below
the draws' queue and the file's queue: rec_CmdBindPipeline counts the presents the link's stand-in is bound in
(vk_pipeline_bound), and the worker that makes the link queues it when its draws asked before it was ready. A
link a scene draws once (a loading screen's, one of the file's that no draw asks for again) takes no worker for
it. A draw that binds the link's own handle, as vk_pipeline_get gives it without the recording thread, asks for
it at once. It is the same link with VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT, into g_pipeline.pcache.
All parts are made with VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT
(VUID-VkGraphicsPipelineCreateInfo-flags-06609). When it is done, it sets Pipe.opt.If all parts are ready at step 1, the GPU thread makes the fast link itself, in about 1 ms, and gives the real pipeline with no stand-in. The measurement must show if that cost is small enough on the GPU thread. If it is not, the link goes to a worker as in step 3.
The stand-in resolves to the best pipeline at its bind. vk_pipeline_resolve, vk_pipeline_ready and
vk_pipeline_now read opt first, then fast, each with acquire order. They wait (only resolve) while neither is
there, which is the time of a part compile and a link. The wait never includes the optimized pipeline.
The swap:
vk_pipeline_get_deferred gives the stand-in while opt is not ready, and the opt handle after. render.c
keeps the handle in its kept draw states (the pipe of each entry of g_draw) and binds again when it changes
(g_dyn.pipe). Thus a draw after the swap binds opt. A draw that kept the stand-in resolves to opt at its next
bind, and g_dyn starts again with each command buffer.draw_state_check path in render.c compares vk_pipeline_ready of two handles of the same Pipe at one time.
Both give the same result, so the swap does not make it report a difference.fast pipeline goes through vk_defer_call on the GPU thread when the GPU thread first sees opt ready. The
frame slot that it goes to recycles after its last submission. All binds of fast are in that frame or before it,
because the recording thread drains in order. opt is set before fast goes, so no resolve reads a freed handle.async_pipelines=1, vk_pipeline_now reports pending only while there is no fast. Draws skip for the time
of a part compile, not of a whole pipeline.The lock fixes of 92df965c9 need nothing more. The workers take no vk_lock. The recording thread waits at the bind
as before, with no renderer lock held, and the wait is now short.
When the device has no fast link (graphicsPipelineLibraryFastLinking false), a link is a compile. The GPL path then
stays off (see Without the extension).
Made from docs/layers/gpu/pipeline-libraries.md at 69237645142c. GPL-3.0-or-later.