[Bf-blender-cvs] [cfb77c54b06] geometry-nodes-simulation: Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error

Patrick Mours noreply at git.blender.org
Mon Dec 19 19:05:24 CET 2022


Commit: cfb77c54b060e835ffc209a1d8d994faa63427b0
Author: Patrick Mours
Date:   Fri Dec 16 14:01:51 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rBcfb77c54b060e835ffc209a1d8d994faa63427b0

Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error

Switching viewport denoising causes kernels to be reloaded with a new
feature mask, which would destroy the existing OptiX pipelines. But OSL
kernels were not reloaded as well, leaving the shading pipeline
uninitialized and therefore causing an error when it is later attempted to
execute it. This fixes that by ensuring OSL kernels are always reloaded
when the normal kernels are too.

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

M	intern/cycles/device/optix/device_impl.cpp

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

diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp
index f4d1969f3f3..601e1193e26 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -579,7 +579,11 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
   link_options.maxTraceDepth = 1;
   link_options.debugLevel = module_options.debugLevel;
 
-  if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE) && !use_osl) {
+  if (use_osl) {
+    /* Re-create OSL pipeline in case kernels are reloaded after it has been created before. */
+    load_osl_kernels();
+  }
+  else if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE)) {
     /* Create shader raytracing and MNEE pipeline. */
     vector<OptixProgramGroup> pipeline_groups;
     pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
@@ -743,6 +747,11 @@ bool OptiXDevice::load_osl_kernels()
     }
   }
 
+  if (osl_kernels.empty()) {
+    /* No OSL shader groups, so no need to create a pipeline. */
+    return true;
+  }
+
   OptixProgramGroupOptions group_options = {}; /* There are no options currently. */
   OptixModuleCompileOptions module_options = {};
   module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;



More information about the Bf-blender-cvs mailing list