[Bf-blender-cvs] [a8530d31c29] master: Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error
Patrick Mours
noreply at git.blender.org
Fri Dec 16 15:41:36 CET 2022
Commit: a8530d31c2971756df7f2b440a0de3d6fcfc3061
Author: Patrick Mours
Date: Fri Dec 16 15:41:21 2022 +0100
Branches: master
https://developer.blender.org/rBa8530d31c2971756df7f2b440a0de3d6fcfc3061
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