radv/rt: reference library shaders during radv_rt_fill_stage_info()
authorDaniel Schürmann <daniel@schuermann.dev>
Mon, 8 May 2023 17:41:12 +0000 (19:41 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 00:37:03 +0000 (00:37 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22096>

src/amd/vulkan/radv_pipeline_rt.c

index 062fd67..25c1c83 100644 (file)
@@ -210,9 +210,10 @@ radv_rt_fill_stage_info(const VkRayTracingPipelineCreateInfoKHR *pCreateInfo,
          struct radv_ray_tracing_pipeline *library_pipeline =
             radv_pipeline_to_ray_tracing(pipeline);
          for (unsigned j = 0; j < library_pipeline->stage_count; ++j) {
+            stages[idx].shader = vk_pipeline_cache_object_ref(library_pipeline->stages[j].shader);
             stages[idx].stage = library_pipeline->stages[j].stage;
+            stages[idx].stack_size = library_pipeline->stages[j].stack_size;
             memcpy(stages[idx].sha1, library_pipeline->stages[j].sha1, SHA1_DIGEST_LENGTH);
-
             idx++;
          }
       }
@@ -367,9 +368,7 @@ radv_rt_precompile_shaders(struct radv_device *device, struct vk_pipeline_cache
                            const struct radv_pipeline_key *key,
                            struct radv_ray_tracing_stage *stages)
 {
-   uint32_t idx;
-
-   for (idx = 0; idx < pCreateInfo->stageCount; idx++) {
+   for (uint32_t idx = 0; idx < pCreateInfo->stageCount; idx++) {
       int64_t stage_start = os_time_get_nano();
       struct radv_pipeline_stage stage;
       radv_pipeline_stage_init(&pCreateInfo->pStages[idx], &stage, stages[idx].stage);
@@ -409,17 +408,6 @@ radv_rt_precompile_shaders(struct radv_device *device, struct vk_pipeline_cache
       }
    }
 
-   /* reference library shaders */
-   if (pCreateInfo->pLibraryInfo) {
-      for (unsigned i = 0; i < pCreateInfo->pLibraryInfo->libraryCount; ++i) {
-         RADV_FROM_HANDLE(radv_pipeline, pipeline, pCreateInfo->pLibraryInfo->pLibraries[i]);
-         struct radv_ray_tracing_pipeline *library = radv_pipeline_to_ray_tracing(pipeline);
-
-         for (unsigned j = 0; j < library->stage_count; ++j)
-            stages[idx++].shader = vk_pipeline_cache_object_ref(library->stages[j].shader);
-      }
-   }
-
    return VK_SUCCESS;
 }