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.
This commit is contained in:
Patrick Mours 2022-12-16 14:01:51 +01:00
parent 599c0db3ff
commit c9eb583460
Notes: blender-bot 2023-12-08 16:39:08 +01:00
Referenced by issue #103408, Regression: Blender crash when moving camera immediately after opening the project (OPTIX)
Referenced by issue #103257, Enabling or disabling OptiX viewport denoising while using OptiX OSL results in an error
1 changed files with 10 additions and 1 deletions

View File

@ -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;