perf(agc): render with dynamic rendering when pipelines come from libraries #2645
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2645"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T09:50:23Z.
What
On devices that link graphics pipelines from libraries (#2636), draws now render with
VK_KHR_dynamic_renderinginstead of render passes. The shader libraries then name no attachment format.With render passes, the pre-rasterization and fragment shader libraries are created against a render pass. They only link with a compatible one, so a shader drawn to targets of other formats compiled again. With dynamic rendering, the attachment formats are part of the fragment output library only. Another target format now builds that library (a fraction of a millisecond, see #2636) and links. This is also what the shader libraries need before they can be built at registration, where the targets aren't known (Discussion #2242).
Changes:
VulkanDevice(and the recorder tests' device) use pipeline libraries only when the device also hasVK_KHR_dynamic_renderingwith its 1.1 dependencies (VK_KHR_depth_stencil_resolve,VK_KHR_create_renderpass2). Every graphics pipeline of such a device uses dynamic rendering, including the ones still created whole (per-face depth bias, rect lists, geometry), so a pass always begins and ends the same way.Pipelinerecords the attachment slots and formats, creates noVkRenderPass, and gives the pipeline aVkPipelineRenderingCreateInfoKHR.Beginstarts the pass withvkCmdBeginRenderingKHR: color slots by export index, an unused slot left without a view, and the depth view also used as stencil for depth-stencil formats. Load and store ops and layouts are the same as the render pass's.Framebufferkeeps its views and creates noVkFramebufferin this mode. The two places that end a pass (Recorder::endOpenRenderPass, the uncontinued draw inDraw.cpp) go throughEndRenderPass, which picksvkCmdEndRenderingKHRorvkCmdEndRenderPass.PipelineLibraryno longer keeps render passes. The shader libraries get an empty rendering info (viewMask0) and an all-dynamic depth-stencil state, so their keys no longer include the attachments or the presence of depth. The fragment output library gets the formats.APS5_NO_GPL=1, keep render passes and whole pipelines as before.Tested
Linux, AMD Radeon 660M (RADV, Mesa 26.2.4), and CI's lavapipe (Mesa 25.2.8).
ctest -R '^agc_|^shader', GPL on (default)APS5_NO_GPL=1(today's path)VK_LAYER_KHRONOS_validation, GPL on and offVUID-vkCmdPipelineBarrier-dstAccessMask-02816,VUID-vkCmdPipelineBarrier-srcAccessMask-02815,VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605)^agc_on CI's lavapipe (GPL and dynamic rendering on), without the 4-minutebuffer_formatagc_pipeline_librarynow also checks that another color target format builds only the fragment output library (counters 2/1/2/3). Before this change, that case built the shader libraries again.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)