From 5443c23983aad96ff8452666d6ca67e3de878634 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 3 Feb 2025 18:26:31 +0100 Subject: [PATCH] radv/meta: add missing pipeline lookups Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/meta/radv_meta_blit.c | 6 ++++++ src/amd/vulkan/meta/radv_meta_blit2d.c | 18 ++++++++++++++++++ src/amd/vulkan/meta/radv_meta_resolve.c | 12 +++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/meta/radv_meta_blit.c b/src/amd/vulkan/meta/radv_meta_blit.c index f7dfd750ddd..856f169d5c7 100644 --- a/src/amd/vulkan/meta/radv_meta_blit.c +++ b/src/amd/vulkan/meta/radv_meta_blit.c @@ -217,6 +217,12 @@ get_pipeline(struct radv_device *device, const struct radv_image_view *src_iview if (src_image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT) key.fs_key = radv_format_meta_fs_key(device, dst_image->vk.format); + VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(&device->meta_state.device, &key, sizeof(key)); + if (pipeline_from_cache != VK_NULL_HANDLE) { + *pipeline_out = pipeline_from_cache; + return VK_SUCCESS; + } + nir_shader *fs; nir_shader *vs = build_nir_vertex_shader(device); diff --git a/src/amd/vulkan/meta/radv_meta_blit2d.c b/src/amd/vulkan/meta/radv_meta_blit2d.c index 708eaedd407..f72dfa60747 100644 --- a/src/amd/vulkan/meta/radv_meta_blit2d.c +++ b/src/amd/vulkan/meta/radv_meta_blit2d.c @@ -511,6 +511,12 @@ get_color_pipeline(struct radv_device *device, enum blit2d_src_type src_type, Vk key.log2_samples = log2_samples; key.fs_key = radv_format_meta_fs_key(device, format); + VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(&device->meta_state.device, &key, sizeof(key)); + if (pipeline_from_cache != VK_NULL_HANDLE) { + *pipeline_out = pipeline_from_cache; + return VK_SUCCESS; + } + texel_fetch_build_func src_func; switch (src_type) { case BLIT2D_SRC_TYPE_IMAGE: @@ -645,6 +651,12 @@ get_depth_only_pipeline(struct radv_device *device, enum blit2d_src_type src_typ key.src_type = src_type; key.log2_samples = log2_samples; + VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(&device->meta_state.device, &key, sizeof(key)); + if (pipeline_from_cache != VK_NULL_HANDLE) { + *pipeline_out = pipeline_from_cache; + return VK_SUCCESS; + } + texel_fetch_build_func src_func; switch (src_type) { case BLIT2D_SRC_TYPE_IMAGE: @@ -797,6 +809,12 @@ get_stencil_only_pipeline(struct radv_device *device, enum blit2d_src_type src_t key.src_type = src_type; key.log2_samples = log2_samples; + VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(&device->meta_state.device, &key, sizeof(key)); + if (pipeline_from_cache != VK_NULL_HANDLE) { + *pipeline_out = pipeline_from_cache; + return VK_SUCCESS; + } + texel_fetch_build_func src_func; switch (src_type) { case BLIT2D_SRC_TYPE_IMAGE: diff --git a/src/amd/vulkan/meta/radv_meta_resolve.c b/src/amd/vulkan/meta/radv_meta_resolve.c index 4b852909d2a..6149570663a 100644 --- a/src/amd/vulkan/meta/radv_meta_resolve.c +++ b/src/amd/vulkan/meta/radv_meta_resolve.c @@ -40,13 +40,19 @@ get_pipeline(struct radv_device *device, unsigned fs_key, VkPipeline *pipeline_o struct radv_resolve_key key; VkResult result; + result = radv_meta_get_noop_pipeline_layout(device, layout_out); + if (result != VK_SUCCESS) + return result; + memset(&key, 0, sizeof(key)); key.type = RADV_META_OBJECT_KEY_RESOLVE_HW; key.fs_key = fs_key; - result = radv_meta_get_noop_pipeline_layout(device, layout_out); - if (result != VK_SUCCESS) - return result; + VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(&device->meta_state.device, &key, sizeof(key)); + if (pipeline_from_cache != VK_NULL_HANDLE) { + *pipeline_out = pipeline_from_cache; + return VK_SUCCESS; + } nir_shader *vs_module = radv_meta_build_nir_vs_generate_vertices(device); nir_shader *fs_module = build_nir_fs(device);