Module: Mesa Branch: main Commit: 12d428bc689d1508e2efb8ebe0012f446bfdb94c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=12d428bc689d1508e2efb8ebe0012f446bfdb94c
Author: Yiwei Zhang <zzyi...@chromium.org> Date: Thu Jan 11 14:55:15 2024 -0800 venus: avoid redundant layout transition for optimal internal layout This ensures no extra barriers when internal layout is wsi layout. Signed-off-by: Yiwei Zhang <zzyi...@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27020> --- src/virtio/vulkan/vn_render_pass.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/virtio/vulkan/vn_render_pass.c b/src/virtio/vulkan/vn_render_pass.c index c2f17482c31..ac229183742 100644 --- a/src/virtio/vulkan/vn_render_pass.c +++ b/src/virtio/vulkan/vn_render_pass.c @@ -76,25 +76,33 @@ } \ } while (false) -static void +static inline void vn_render_pass_count_present_src(const VkRenderPassCreateInfo *create_info, uint32_t *initial_count, uint32_t *final_count) { + if (VN_PRESENT_SRC_INTERNAL_LAYOUT == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) { + *initial_count = *final_count = 0; + return; + } COUNT_PRESENT_SRC(create_info->pAttachments, create_info->attachmentCount, initial_count, final_count); } -static void +static inline void vn_render_pass_count_present_src2(const VkRenderPassCreateInfo2 *create_info, uint32_t *initial_count, uint32_t *final_count) { + if (VN_PRESENT_SRC_INTERNAL_LAYOUT == VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) { + *initial_count = *final_count = 0; + return; + } COUNT_PRESENT_SRC(create_info->pAttachments, create_info->attachmentCount, initial_count, final_count); } -static void +static inline void vn_render_pass_replace_present_src(struct vn_render_pass *pass, const VkRenderPassCreateInfo *create_info, VkAttachmentDescription *out_atts) @@ -103,7 +111,7 @@ vn_render_pass_replace_present_src(struct vn_render_pass *pass, create_info->attachmentCount, out_atts); } -static void +static inline void vn_render_pass_replace_present_src2(struct vn_render_pass *pass, const VkRenderPassCreateInfo2 *create_info, VkAttachmentDescription2 *out_atts)