Module: Mesa Branch: main Commit: 03d2bd6042d2d93caaab70892e35ffffa16b4bb7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=03d2bd6042d2d93caaab70892e35ffffa16b4bb7
Author: Samuel Pitoiset <[email protected]> Date: Mon Apr 3 10:12:25 2023 +0200 radv: ensure to retain NIR shaders for GPL libs found in the cache Even if we are able to get the assembly from the shaders cache for graphics pipeline libraries, we still need to retain NIR shaders in case the LTO pipelines won't be find in the cache. Signed-off-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22264> --- src/amd/vulkan/radv_pipeline.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index f357c64b4fd..3ed41584f8f 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -3254,6 +3254,27 @@ radv_graphics_pipeline_compile(struct radv_graphics_pipeline *pipeline, if (found_in_application_cache) pipeline_feedback.flags |= VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT; + if (pipeline->base.type == RADV_PIPELINE_GRAPHICS_LIB && retain_shaders) { + /* For graphics pipeline libraries created with the RETAIN_LINK_TIME_OPTIMIZATION flag, we + * still need to compile the SPIR-V to NIR because we can't know if the LTO pipelines will + * be find in the shaders cache. + */ + if (noop_fs) { + nir_builder fs_b = radv_meta_init_shader(device, MESA_SHADER_FRAGMENT, "noop_fs"); + + stages[MESA_SHADER_FRAGMENT] = (struct radv_pipeline_stage) { + .stage = MESA_SHADER_FRAGMENT, + .internal_nir = fs_b.shader, + .entrypoint = noop_fs_entrypoint, + .feedback = { + .flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, + }, + }; + } + + radv_pipeline_get_nir(device, pipeline, stages, pipeline_key, retain_shaders); + } + result = VK_SUCCESS; goto done; }
