Mesa (main): radv: add radv_generate_pipeline_key() for common graphics/compute keys

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 8 06:39:44 UTC 2022


Module: Mesa
Branch: main
Commit: 61176121891007d6882d86f3e40038134118a64d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=61176121891007d6882d86f3e40038134118a64d

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Apr  7 13:54:12 2022 +0200

radv: add radv_generate_pipeline_key() for common graphics/compute keys

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15792>

---

 src/amd/vulkan/radv_pipeline.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index dba276fce90..ad4140fd1bd 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -2913,6 +2913,23 @@ radv_get_attrib_stride(const VkPipelineVertexInputStateCreateInfo *input_state,
    return 0;
 }
 
+static struct radv_pipeline_key
+radv_generate_pipeline_key(const struct radv_pipeline *pipeline, VkPipelineCreateFlags flags)
+{
+   struct radv_device *device = pipeline->device;
+   struct radv_pipeline_key key;
+
+   memset(&key, 0, sizeof(key));
+
+   if (flags & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT)
+      key.optimisations_disabled = 1;
+
+   key.disable_aniso_single_level = device->instance->disable_aniso_single_level &&
+                                    device->physical_device->rad_info.chip_class < GFX8;
+
+   return key;
+}
+
 static struct radv_pipeline_key
 radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
                                     const VkGraphicsPipelineCreateInfo *pCreateInfo,
@@ -2922,11 +2939,7 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
       vk_find_struct_const(pCreateInfo->pNext, PIPELINE_RENDERING_CREATE_INFO);
    bool uses_dynamic_stride = false;
 
-   struct radv_pipeline_key key;
-   memset(&key, 0, sizeof(key));
-
-   if (pCreateInfo->flags & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT)
-      key.optimisations_disabled = 1;
+   struct radv_pipeline_key key = radv_generate_pipeline_key(pipeline, pCreateInfo->flags);
 
    key.has_multiview_view_index = !!render_create_info->viewMask;
 
@@ -3066,8 +3079,6 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
 
    key.use_ngg = pipeline->device->physical_device->use_ngg;
    key.adjust_frag_coord_z = pipeline->device->adjust_frag_coord_z;
-   key.disable_aniso_single_level = pipeline->device->instance->disable_aniso_single_level &&
-                                    pipeline->device->physical_device->rad_info.chip_class < GFX8;
 
    return key;
 }
@@ -6720,11 +6731,7 @@ radv_generate_compute_pipeline_key(struct radv_pipeline *pipeline,
                                    const VkComputePipelineCreateInfo *pCreateInfo)
 {
    const VkPipelineShaderStageCreateInfo *stage = &pCreateInfo->stage;
-   struct radv_pipeline_key key;
-   memset(&key, 0, sizeof(key));
-
-   if (pCreateInfo->flags & VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT)
-      key.optimisations_disabled = 1;
+   struct radv_pipeline_key key = radv_generate_pipeline_key(pipeline, pCreateInfo->flags);
 
    const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *subgroup_size =
       vk_find_struct_const(stage->pNext,
@@ -6738,9 +6745,6 @@ radv_generate_compute_pipeline_key(struct radv_pipeline *pipeline,
       key.cs.require_full_subgroups = true;
    }
 
-   key.disable_aniso_single_level = pipeline->device->instance->disable_aniso_single_level &&
-                                    pipeline->device->physical_device->rad_info.chip_class < GFX8;
-
    return key;
 }
 



More information about the mesa-commit mailing list