diff options
author | Julian Eisel <julian@blender.org> | 2020-03-26 23:03:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-03-26 23:18:45 +0300 |
commit | c94b6209861ca7cc3985b53474feed7d94c0221a (patch) | |
tree | 752054f0dca1338cda5cf8ad4f6d18573fcca3b9 /intern/cycles/device/device.cpp | |
parent | 357ed79cb93f9d655501a828c6cddd68282de62d (diff) | |
parent | afb1a64ccb81b7ed792f64151986f40f53af8da5 (diff) |
Merge branch 'master' into wm-drag-drop-rewrite
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r-- | intern/cycles/device/device.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 76670351734..d94d409175b 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -25,11 +25,11 @@ #include "util/util_logging.h" #include "util/util_math.h" #include "util/util_opengl.h" -#include "util/util_time.h" +#include "util/util_string.h" #include "util/util_system.h" +#include "util/util_time.h" #include "util/util_types.h" #include "util/util_vector.h" -#include "util/util_string.h" CCL_NAMESPACE_BEGIN @@ -366,6 +366,15 @@ void Device::draw_pixels(device_memory &rgba, Device *Device::create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background) { +#ifdef WITH_MULTI + if (!info.multi_devices.empty()) { + /* Always create a multi device when info contains multiple devices. + * This is done so that the type can still be e.g. DEVICE_CPU to indicate + * that it is a homogeneous collection of devices, which simplifies checks. */ + return device_multi_create(info, stats, profiler, background); + } +#endif + Device *device; switch (info.type) { @@ -388,11 +397,6 @@ Device *Device::create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool device = NULL; break; #endif -#ifdef WITH_MULTI - case DEVICE_MULTI: - device = device_multi_create(info, stats, profiler, background); - break; -#endif #ifdef WITH_NETWORK case DEVICE_NETWORK: device = device_network_create(info, stats, profiler, "127.0.0.1"); @@ -586,7 +590,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices, } DeviceInfo info; - info.type = DEVICE_MULTI; + info.type = subdevices.front().type; info.id = "MULTI"; info.description = "Multi Device"; info.num = 0; @@ -624,6 +628,14 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices, info.multi_devices.push_back(device); } + /* Create unique ID for this combination of devices. */ + info.id += device.id; + + /* Set device type to MULTI if subdevices are not of a common type. */ + if (device.type != info.type) { + info.type = DEVICE_MULTI; + } + /* Accumulate device info. */ info.has_half_images &= device.has_half_images; info.has_volume_decoupled &= device.has_volume_decoupled; |