[Bf-blender-cvs] [bc1e675bb90] master: Fix T91603: Cycles crash when volume becomes visible

Sergey Sharybin noreply at git.blender.org
Wed Sep 22 17:10:09 CEST 2021


Commit: bc1e675bb905baec73f2758b009826530678e436
Author: Sergey Sharybin
Date:   Wed Sep 22 17:05:44 2021 +0200
Branches: master
https://developer.blender.org/rBbc1e675bb905baec73f2758b009826530678e436

Fix T91603: Cycles crash when volume becomes visible

Making object which uses volume shader invisible will mark the shader
as not having a volume, forcing re-compilation of the shader to bring
it back to a consistent state.

The compilation is happening as part of scene update, which needs to
know kernel features. So there is a feedback loop.

Use more relaxed way of knowing whether there is a volume in the
shader for the kernel features, which doesn't require shader to be
compiled first.

Solves issues from the report, but potentially causes extra memory
allocated if the volume part of graph is fully optimized out. This
downside is solvable, but would need to split scene update into two
steps (the one which requires on kernel, and the one which does not).
It will be an interesting project to tackle, but for a bug fix is
better to use simpler solution.

===================================================================

M	intern/cycles/render/shader.cpp

===================================================================

diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index f6b23606e58..23786a3390f 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -729,7 +729,7 @@ uint ShaderManager::get_kernel_features(Scene *scene)
     }
     /* On top of volume nodes, also check if we need volume sampling because
      * e.g. an Emission node would slip through the KERNEL_FEATURE_NODE_VOLUME check */
-    if (shader->has_volume) {
+    if (shader->has_volume_connected) {
       kernel_features |= KERNEL_FEATURE_VOLUME;
     }
   }



More information about the Bf-blender-cvs mailing list