From: Samuel Pitoiset Date: Thu, 5 Jan 2023 16:58:45 +0000 (+0100) Subject: radv: only copy non-NULL shaders when loaded from the cache X-Git-Tag: upstream/23.3.3~10543 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1239fcab4d3ebbb9f225c17af41a6f6ee6178f01;p=platform%2Fupstream%2Fmesa.git 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: --- 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) {