[Bf-blender-cvs] [64c9077d792] cycles-x: Fix Cycles X multi-device type generation

Sergey Sharybin noreply at git.blender.org
Tue Jun 29 11:52:30 CEST 2021


Commit: 64c9077d792fcfe32960ef4651d300496122fc74
Author: Sergey Sharybin
Date:   Mon Jun 28 18:07:13 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB64c9077d792fcfe32960ef4651d300496122fc74

Fix Cycles X multi-device type generation

The info type can not be set to first device type because the device
might be ignored. So delay type assignment until we have a device which
is known to be used.

Fixes issue in viewport when OptiX+OptiX will be considered an OptiX
device with 2 sub-devices, and OptiX+OptiX+CPU will be considered a
Multi device. The issue with the latter one is that the info IDs in
both cases are the same, but not the type, making it a wrong comparison
in `DeviceInfo::operator==`.

Differential Revision: https://developer.blender.org/D11729

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

M	intern/cycles/device/device.cpp

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

diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 81a0807bad3..a5eb56f1e00 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -310,7 +310,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
   }
 
   DeviceInfo info;
-  info.type = subdevices.front().type;
+  info.type = DEVICE_NONE;
   info.id = "MULTI";
   info.description = "Multi Device";
   info.num = 0;
@@ -355,7 +355,10 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
     info.id += device.id;
 
     /* Set device type to MULTI if subdevices are not of a common type. */
-    if (device.type != info.type) {
+    if (info.type == DEVICE_NONE) {
+      info.type = device.type;
+    }
+    else if (device.type != info.type) {
       info.type = DEVICE_MULTI;
     }



More information about the Bf-blender-cvs mailing list