diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 71689c14cdc..212955ece15 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -3384,6 +3384,21 @@ radv_pipeline_create_ps_epilog(struct radv_graphics_pipeline *pipeline, return true; } +static bool +radv_pipeline_capture_shaders(const struct radv_device *device, VkPipelineCreateFlags flags) +{ + return (flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) || + device->keep_shader_info; +} + +bool +radv_pipeline_capture_shader_stats(const struct radv_device *device, VkPipelineCreateFlags flags) +{ + return (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) || + (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) || + device->keep_shader_info; +} + static VkResult radv_graphics_pipeline_compile(struct radv_pipeline *pipeline, struct radv_pipeline_layout *pipeline_layout, @@ -3400,12 +3415,8 @@ radv_graphics_pipeline_compile(struct radv_pipeline *pipeline, struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL}; struct radv_shader_binary *gs_copy_binary = NULL; unsigned char hash[20]; - bool keep_executable_info = - (flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) || - device->keep_shader_info; - bool keep_statistic_info = (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) || - (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) || - device->keep_shader_info; + bool keep_executable_info = radv_pipeline_capture_shaders(pipeline->device, flags); + bool keep_statistic_info = radv_pipeline_capture_shader_stats(pipeline->device, flags); struct radv_pipeline_stage stages[MESA_VULKAN_SHADER_STAGES] = {0}; VkPipelineCreationFeedback pipeline_feedback = { .flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, @@ -5372,12 +5383,8 @@ radv_compute_pipeline_compile(struct radv_pipeline *pipeline, { struct radv_shader_binary *binaries[MESA_VULKAN_SHADER_STAGES] = {NULL}; unsigned char hash[20]; - bool keep_executable_info = - (flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR) || - device->keep_shader_info; - bool keep_statistic_info = (flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) || - (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) || - device->keep_shader_info; + bool keep_executable_info = radv_pipeline_capture_shaders(pipeline->device, flags); + bool keep_statistic_info = radv_pipeline_capture_shader_stats(pipeline->device, flags); struct radv_pipeline_stage cs_stage = {0}; VkPipelineCreationFeedback pipeline_feedback = { .flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index ea8e7003607..544ca9a8719 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -258,9 +258,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, struct radv_ray_tracing_pipeline *rt_pipeline = NULL; uint8_t hash[20]; nir_shader *shader = NULL; - bool keep_statistic_info = - (pCreateInfo->flags & VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR) || - (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADER_STATS) || device->keep_shader_info; + bool keep_statistic_info = radv_pipeline_capture_shader_stats(device, pCreateInfo->flags); if (pCreateInfo->flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) return radv_rt_pipeline_library_create(_device, _cache, pCreateInfo, pAllocator, pPipeline); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 1401853889d..42b02c0e458 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -2270,6 +2270,9 @@ VkResult radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipeline, bool is_internal); +bool radv_pipeline_capture_shader_stats(const struct radv_device *device, + VkPipelineCreateFlags flags); + void radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline, const VkAllocationCallbacks *allocator);