radv/rt: Properly handle pNext of pipeline library stages
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Sat, 4 Mar 2023 16:18:25 +0000 (17:18 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sun, 12 Mar 2023 13:18:15 +0000 (13:18 +0000)
Fixes
dEQP-VK.pipeline.pipeline_library.graphics_library.misc.non_graphics.shader_module_info_rt_lib.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21707>

src/amd/vulkan/radv_pipeline_rt.c

index 1193e1f..ad80077 100644 (file)
@@ -383,6 +383,8 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
          const VkPipelineShaderStageModuleIdentifierCreateInfoEXT *iinfo =
             vk_find_struct_const(local_create_info.pStages[i].pNext,
                                  PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT);
+         const VkShaderModuleCreateInfo *minfo =
+            vk_find_struct_const(local_create_info.pStages[i].pNext, SHADER_MODULE_CREATE_INFO);
 
          if (module) {
             struct vk_shader_module *new_module =
@@ -398,6 +400,16 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
             new_module->size = module->size;
             memcpy(new_module->data, module->data, module->size);
 
+            module = new_module;
+         } else if (minfo) {
+            module = ralloc_size(pipeline->ctx, sizeof(struct vk_shader_module) + minfo->codeSize);
+            if (!module)
+               goto fail;
+
+            vk_shader_module_init(&device->vk, module, minfo);
+         }
+
+         if (module) {
             const VkSpecializationInfo *spec = pipeline->stages[i].pSpecializationInfo;
             if (spec) {
                VkSpecializationInfo *new_spec = ralloc(pipeline->ctx, VkSpecializationInfo);
@@ -420,7 +432,7 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
                pipeline->stages[i].pSpecializationInfo = new_spec;
             }
 
-            pipeline->stages[i].module = vk_shader_module_to_handle(new_module);
+            pipeline->stages[i].module = vk_shader_module_to_handle(module);
             pipeline->stages[i].pName = ralloc_strdup(pipeline->ctx, pipeline->stages[i].pName);
             if (!pipeline->stages[i].pName)
                goto fail;