diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 061ddd13464..26ad7bfa390 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -3621,9 +3621,10 @@ static bool anv_ray_tracing_pipeline_load_cached_shaders(struct anv_ray_tracing_pipeline *pipeline, struct vk_pipeline_cache *cache, const VkRayTracingPipelineCreateInfoKHR *info, - struct anv_pipeline_stage *stages) + struct anv_pipeline_stage *stages, + VkPipelineCreationFeedback *pipeline_feedback) { - uint32_t shaders = 0, cache_hits = 0; + uint32_t shaders = 0, found = 0, cache_hits = 0; for (uint32_t i = 0; i < info->stageCount; i++) { if (stages[i].info == NULL) continue; @@ -3643,13 +3644,20 @@ anv_ray_tracing_pipeline_load_cached_shaders(struct anv_ray_tracing_pipeline *pi VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT; } - if (stages[i].bin != NULL) + if (stages[i].bin != NULL) { + found++; anv_pipeline_add_executables(&pipeline->base, &stages[i]); + } stages[i].feedback.duration += os_time_get_nano() - stage_start; } - return cache_hits == shaders; + if (cache_hits == shaders) { + pipeline_feedback->flags |= + VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT; + } + + return found == shaders; } static VkResult @@ -3671,9 +3679,8 @@ anv_pipeline_compile_ray_tracing(struct anv_ray_tracing_pipeline *pipeline, (pipeline->base.flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR); if (!skip_cache_lookup && - anv_ray_tracing_pipeline_load_cached_shaders(pipeline, cache, info, stages)) { - pipeline_feedback.flags |= - VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT; + anv_ray_tracing_pipeline_load_cached_shaders(pipeline, cache, info, stages, + &pipeline_feedback)) { goto done; } @@ -3684,6 +3691,15 @@ anv_pipeline_compile_ray_tracing(struct anv_ray_tracing_pipeline *pipeline, if (stages[i].info == NULL) continue; + /* Intersection and any-hit need to fetch the nir always, + * so that they can be handled correctly below in the group section. + * For the other stages, if we found them in the cache, skip this part. + */ + if (!(stages[i].stage == MESA_SHADER_INTERSECTION || + stages[i].stage == MESA_SHADER_ANY_HIT) && + stages[i].bin != NULL) + continue; + int64_t stage_start = os_time_get_nano(); VkResult result = anv_pipeline_stage_get_nir(&pipeline->base, cache,