From 1239fcab4d3ebbb9f225c17af41a6f6ee6178f01 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 5 Jan 2023 17:58:45 +0100 Subject: [PATCH] radv: only copy non-NULL shaders when loaded from the cache With GPL, we don't necessarily load all stages from the same cache entry and other stages might have been imported from libraries, so don't overwrite them. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 89b56c0..9980a4b 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -382,7 +382,12 @@ radv_create_shaders_from_pipeline_cache(struct radv_device *device, } } - memcpy(pipeline->shaders, entry->shaders, sizeof(entry->shaders)); + for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) { + if (!entry->shaders[i]) + continue; + + pipeline->shaders[i] = entry->shaders[i]; + } if (pipeline->shaders[MESA_SHADER_GEOMETRY] && !pipeline->shaders[MESA_SHADER_GEOMETRY]->info.is_ngg) { -- 2.7.4