[Bf-blender-cvs] [6bd6d7aec75] geometry-nodes-simulation: Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error

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


Commit: 6bd6d7aec754e4e4f3061bb2de34b73c76a60944
Author: Patrick Mours
Date:   Fri Dec 16 15:41:21 2022 +0100
Branches: geometry-nodes-simulation
https://developer.blender.org/rB6bd6d7aec754e4e4f3061bb2de34b73c76a60944

Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error

Materials without connections to the output node would crash with OSL
in OptiX, since the Cycles `OSLCompiler` generates an empty shader
group reference for them, which resulted in the OptiX device
implementation setting an empty SBT entry for the corresponding direct
callables, which then crashed when calling those direct callables was
attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries
for empty shader groups to a dummy direct callable that does nothing.

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

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 601e1193e26..23e7bbfa7bb 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -866,6 +866,11 @@ bool OptiXDevice::load_osl_kernels()
       optix_assert(optixSbtRecordPackHeader(osl_groups[i], &sbt_data[NUM_PROGRAM_GROUPS + i]));
       optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i]));
     }
+    else {
+      /* Default to "__direct_callable__dummy_services", so that OSL evaluation for empty
+       * materials has direct callables to call and does not crash. */
+      optix_assert(optixSbtRecordPackHeader(osl_groups.back(), &sbt_data[NUM_PROGRAM_GROUPS + i]));
+    }
   }
   sbt_data.copy_to_device(); /* Upload updated SBT to device. */



More information about the Bf-blender-cvs mailing list