From d4808c7d954afeee3a9992d8d850a20284f5d903 Mon Sep 17 00:00:00 2001 From: Michael Parkin-White Date: Mon, 20 Feb 2023 12:42:25 +0000 Subject: [PATCH] Fix: Resolve EEVEE cache warming assertion. Erroneous cache warming case where the generated material is identical to default material and cached shader is re-used, resulting in case where the parent shader is identical to the source. Authored by Apple: Michael Parkin-White Ref #96261 --- source/blender/gpu/intern/gpu_material.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index a6d411a6ef0..0e73398f31e 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -951,14 +951,16 @@ void GPU_material_compile(GPUMaterial *mat) * As PSOs do not always match for default shaders, we limit warming for PSO * configurations to ensure compile time remains fast, as these first * entries will be the most commonly used PSOs. As not all PSOs are necessarily - * required immediately, this limit should remain low (1-3 at most). - * */ + * required immediately, this limit should remain low (1-3 at most). */ if (mat->default_mat != NULL && mat->default_mat != mat) { if (mat->default_mat->pass != NULL) { GPUShader *parent_sh = GPU_pass_shader_get(mat->default_mat->pass); if (parent_sh) { - GPU_shader_set_parent(sh, parent_sh); - GPU_shader_warm_cache(sh, 1); + /* Skip warming if cached pass is identical to the default material. */ + if (mat->default_mat->pass != mat->pass && parent_sh != sh) { + GPU_shader_set_parent(sh, parent_sh); + GPU_shader_warm_cache(sh, 1); + } } } } -- 2.30.2