perf(agc): render with dynamic rendering when pipelines come from libraries #2645

Merged
adriadam10 merged 1 commit from upstream-pr/2645 into main 2026-10-10 10:00:40 +00:00
adriadam10 commented 2026-10-10 09:50:23 +00:00 (Migrated from github.com)

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_rendering instead 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 has VK_KHR_dynamic_rendering with 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.
  • Pipeline records the attachment slots and formats, creates no VkRenderPass, and gives the pipeline a VkPipelineRenderingCreateInfoKHR. Begin starts the pass with vkCmdBeginRenderingKHR: 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.
  • Framebuffer keeps its views and creates no VkFramebuffer in this mode. The two places that end a pass (Recorder::endOpenRenderPass, the uncontinued draw in Draw.cpp) go through EndRenderPass, which picks vkCmdEndRenderingKHR or vkCmdEndRenderPass.
  • PipelineLibrary no longer keeps render passes. The shader libraries get an empty rendering info (viewMask 0) 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.
  • Devices without these extensions, and 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).

result
ctest -R '^agc_|^shader', GPL on (default) 319/319
same with APS5_NO_GPL=1 (today's path) 319/319
same under VK_LAYER_KHRONOS_validation, GPL on and off no VUID only with GPL (both report the same 3 already on main: VUID-vkCmdPipelineBarrier-dstAccessMask-02816, VUID-vkCmdPipelineBarrier-srcAccessMask-02815, VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605)
^agc_ on CI's lavapipe (GPL and dynamic rendering on), without the 4-minute buffer_format 317/317

agc_pipeline_library now 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

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#2636 is merged)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4810316309 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2645). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T09:50:23Z. --- ### What On devices that link graphics pipelines from libraries (#2636), draws now render with `VK_KHR_dynamic_rendering` instead 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 has `VK_KHR_dynamic_rendering` with 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. - `Pipeline` records the attachment slots and formats, creates no `VkRenderPass`, and gives the pipeline a `VkPipelineRenderingCreateInfoKHR`. `Begin` starts the pass with `vkCmdBeginRenderingKHR`: 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. - `Framebuffer` keeps its views and creates no `VkFramebuffer` in this mode. The two places that end a pass (`Recorder::endOpenRenderPass`, the uncontinued draw in `Draw.cpp`) go through `EndRenderPass`, which picks `vkCmdEndRenderingKHR` or `vkCmdEndRenderPass`. - `PipelineLibrary` no longer keeps render passes. The shader libraries get an empty rendering info (`viewMask` 0) 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. - Devices without these extensions, and `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). | | result | |---|---| | `ctest -R '^agc_\|^shader'`, GPL on (default) | 319/319 | | same with `APS5_NO_GPL=1` (today's path) | 319/319 | | same under `VK_LAYER_KHRONOS_validation`, GPL on and off | no VUID only with GPL (both report the same 3 already on main: `VUID-vkCmdPipelineBarrier-dstAccessMask-02816`, `VUID-vkCmdPipelineBarrier-srcAccessMask-02815`, `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605`) | | `^agc_` on CI's lavapipe (GPL and dynamic rendering on), without the 4-minute `buffer_format` | 317/317 | `agc_pipeline_library` now 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 <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#2636 is merged) - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2645
No description provided.