radv: fix importing retained NIR shaders when a lib uses the RETAIN bit

Fixes couple of GPL regressions with VKCTS, I thought this was test
bugs but it's valid behaviour as long as the libary uses
VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21245>
This commit is contained in:
Samuel Pitoiset 2023-02-10 18:08:53 +01:00 committed by Marge Bot
parent edf78810a7
commit 9f8c563e10

View file

@ -959,6 +959,8 @@ radv_graphics_pipeline_import_lib(struct radv_graphics_pipeline *pipeline,
struct radv_graphics_lib_pipeline *lib,
bool link_optimize)
{
bool import_nir = false;
/* There should be no common blocks between a lib we import and the current
* pipeline we're building.
*/
@ -969,10 +971,14 @@ radv_graphics_pipeline_import_lib(struct radv_graphics_pipeline *pipeline,
vk_graphics_pipeline_state_merge(state, &lib->graphics_state);
/* When link time optimization is enabled, import the retained NIR shaders from the library.
* Otherwise, import the compiled binaries (ie. fast link).
/* Import the NIR shaders when LTO is enabled or when a libary uses the retain bit.
* Otherwise, compiled binaries are imported for fast-linking.
*/
if (link_optimize) {
if (link_optimize || pipeline->retain_shaders) {
import_nir = true;
}
if (import_nir) {
/* Import the NIR shaders (after SPIRV->NIR). */
for (uint32_t s = 0; s < ARRAY_SIZE(lib->base.base.shaders); s++) {
if (!lib->base.retained_shaders[s].nir)