[Bf-blender-cvs] [4635dd6aed4] master: Fix T104157: Deleting an active OSL node causes issues

Patrick Mours noreply at git.blender.org
Fri Jan 27 16:14:43 CET 2023


Commit: 4635dd6aed4c97ea234508e774db991926a7b3cf
Author: Patrick Mours
Date:   Fri Jan 27 15:58:03 2023 +0100
Branches: master
https://developer.blender.org/rB4635dd6aed4c97ea234508e774db991926a7b3cf

Fix T104157: Deleting an active OSL node causes issues

Removing all OSL script nodes from the shader graph would cause that
graph to no longer report it using `KERNEL_FEATURE_SHADER_RAYTRACE`
via `ShaderManager::get_graph_kernel_features`, but the shader object
itself still would have the `has_surface_raytrace` field set.
This caused kernels to be reloaded without shader raytracing support, but
later the `DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE`
kernel would still be invoked since the shader continued to report it
requiring that through the `SD_HAS_RAYTRACE` flag set because of
`has_surface_raytrace`.
Fix that by ensuring `has_surface_raytrace` is reset on every shader update,
so that when all OSL script nodes are deleted it is set to false, and only
stays true when there are still OSL script nodes (or other nodes using it).

Maniphest Tasks: T104157

Differential Revision: https://developer.blender.org/D17140

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

M	intern/cycles/scene/osl.cpp

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

diff --git a/intern/cycles/scene/osl.cpp b/intern/cycles/scene/osl.cpp
index 73a8553c5d5..53e993b8135 100644
--- a/intern/cycles/scene/osl.cpp
+++ b/intern/cycles/scene/osl.cpp
@@ -1241,6 +1241,7 @@ void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
 
     shader->has_surface = false;
     shader->has_surface_transparent = false;
+    shader->has_surface_raytrace = false;
     shader->has_surface_bssrdf = false;
     shader->has_bump = has_bump;
     shader->has_bssrdf_bump = has_bump;



More information about the Bf-blender-cvs mailing list