Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2017-10-23 01:04:20 +0300
committerJulian Eisel <eiseljulian@gmail.com>2017-10-23 01:04:20 +0300
commit147f9585db495202833eeb91eefc872ed2bdc178 (patch)
tree28ca153d24c852623c0e3a38843d4efa83aed41a /intern/cycles/device/device.cpp
parentbf26509855cf042375c44cbe729cd0e5262bb519 (diff)
parent6dfe4cbc6b8717223c631e80af6c7552576966e1 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r--intern/cycles/device/device.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 19c4bec55a8..5f01bd535d0 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -27,6 +27,7 @@
#include "util/util_math.h"
#include "util/util_opengl.h"
#include "util/util_time.h"
+#include "util/util_system.h"
#include "util/util_types.h"
#include "util/util_vector.h"
#include "util/util_string.h"
@@ -512,7 +513,7 @@ string Device::device_capabilities()
return capabilities;
}
-DeviceInfo Device::get_multi_device(vector<DeviceInfo> subdevices)
+DeviceInfo Device::get_multi_device(const vector<DeviceInfo>& subdevices, int threads, bool background)
{
assert(subdevices.size() > 1);
@@ -520,18 +521,38 @@ DeviceInfo Device::get_multi_device(vector<DeviceInfo> subdevices)
info.type = DEVICE_MULTI;
info.id = "MULTI";
info.description = "Multi Device";
- info.multi_devices = subdevices;
info.num = 0;
info.has_bindless_textures = true;
info.has_volume_decoupled = true;
info.has_qbvh = true;
- foreach(DeviceInfo &device, subdevices) {
- assert(device.type == info.multi_devices[0].type);
-
+ foreach(const DeviceInfo &device, subdevices) {
info.has_bindless_textures &= device.has_bindless_textures;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_qbvh &= device.has_qbvh;
+
+ if(device.type == DEVICE_CPU && subdevices.size() > 1) {
+ if(background) {
+ int orig_cpu_threads = (threads)? threads: system_cpu_thread_count();
+ int cpu_threads = max(orig_cpu_threads - (subdevices.size() - 1), 0);
+
+ if(cpu_threads >= 1) {
+ DeviceInfo cpu_device = device;
+ cpu_device.cpu_threads = cpu_threads;
+ info.multi_devices.push_back(cpu_device);
+ }
+
+ VLOG(1) << "CPU render threads reduced from "
+ << orig_cpu_threads << " to " << cpu_threads
+ << ", to dedicate to GPU.";
+ }
+ else {
+ VLOG(1) << "CPU render threads disabled for interactive render.";
+ }
+ }
+ else {
+ info.multi_devices.push_back(device);
+ }
}
return info;