[Bf-blender-cvs] [129093fbce0] master: Cycles: Fix crash when rendering with OSL on multiple GPUs

Patrick Mours noreply at git.blender.org
Mon Jan 30 19:41:22 CET 2023


Commit: 129093fbce0b73219fa8c270072ba5400120033d
Author: Patrick Mours
Date:   Mon Jan 30 19:40:02 2023 +0100
Branches: master
https://developer.blender.org/rB129093fbce0b73219fa8c270072ba5400120033d

Cycles: Fix crash when rendering with OSL on multiple GPUs

The `MultiDevice` implementation of `get_cpu_osl_memory` returns a
nullptr when there is no CPU device in the mix. As such access to that
crashed in `update_osl_globals`. But that only updates maps that are not
currently used on the GPU anyway, so can just skip that when the CPU
is not used for rendering.

Maniphest Tasks: T104216

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

M	intern/cycles/scene/geometry.cpp

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

diff --git a/intern/cycles/scene/geometry.cpp b/intern/cycles/scene/geometry.cpp
index 8e831187477..a1df24878c9 100644
--- a/intern/cycles/scene/geometry.cpp
+++ b/intern/cycles/scene/geometry.cpp
@@ -306,6 +306,11 @@ void GeometryManager::update_osl_globals(Device *device, Scene *scene)
 {
 #ifdef WITH_OSL
   OSLGlobals *og = (OSLGlobals *)device->get_cpu_osl_memory();
+  if (og == nullptr) {
+    /* Can happen when rendering with multiple GPUs, but no CPU (in which case the name maps filled
+     * below are not used anyway) */
+    return;
+  }
 
   og->object_name_map.clear();
   og->object_names.clear();



More information about the Bf-blender-cvs mailing list