Fix #147340: EEVEE: Crash on failed world material compilation

- Check for failed World materials.
- Remove invalid links (unsure about this one).

(4.5 LTS backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/147445
This commit is contained in:
Miguel Pozo
2025-10-07 15:28:46 +02:00
parent d71151df4c
commit 610555dbe3
2 changed files with 8 additions and 3 deletions

View File

@@ -120,6 +120,12 @@ void World::sync()
GPUMaterial *gpumat = inst_.shaders.world_shader_get(
bl_world, ntree, MAT_PIPE_DEFERRED, !wait_ready);
if (GPU_material_status(gpumat) == GPU_MAT_FAILED) {
bl_world = default_world_get();
ntree = bl_world->nodetree;
gpumat = inst_.shaders.world_shader_get(bl_world, ntree, MAT_PIPE_DEFERRED, !wait_ready);
}
if (GPU_material_status(gpumat) == GPU_MAT_QUEUED) {
is_ready_ = false;
return;

View File

@@ -434,10 +434,9 @@ static bool ntree_shader_implicit_closure_cast(bNodeTree *ntree)
modified = true;
}
else if ((link->fromsock->type == SOCK_SHADER) && (link->tosock->type != SOCK_SHADER)) {
/* Meh. Not directly visible to the user. But better than nothing. */
fprintf(stderr, "Shader Nodetree Error: Invalid implicit socket conversion\n");
blender::bke::node_remove_link(ntree, *link);
BKE_ntree_update_after_single_tree_change(*G.main, *ntree);
return false;
modified = true;
}
}
if (modified) {