From 4635dd6aed4c97ea234508e774db991926a7b3cf Mon Sep 17 00:00:00 2001 From: Patrick Mours Date: Fri, 27 Jan 2023 15:58:03 +0100 Subject: [PATCH] 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 --- intern/cycles/scene/osl.cpp | 1 + 1 file changed, 1 insertion(+) 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;