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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-21 19:58:59 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-21 21:13:44 +0300
commitdc9eb8234fe4c9c561a3bfb9a8e3a3cefe77d5e3 (patch)
treeb5d93ce6d13577a8d922b2675dbc7b55b1557f01 /intern/cycles/device/device.cpp
parentefd70ab78f0c0d9288508fd28988c969a0cbd31a (diff)
Cycles: combined CPU + GPU rendering support.
CPU rendering will be restricted to a BVH2, which is not ideal for raytracing performance but can be shared with the GPU. Decoupled volume shading will be disabled to match GPU volume sampling. The number of CPU rendering threads is reduced to leave one core dedicated to each GPU. Viewport rendering will also only use GPU rendering still. So along with the BVH2 usage, perfect scaling should not be expected. Go to User Preferences > System to enable the CPU to render alongside the GPU. Differential Revision: https://developer.blender.org/D2873
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r--intern/cycles/device/device.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 7b0875965f8..f31cacd8ec1 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -23,9 +23,11 @@
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_half.h"
+#include "util/util_logging.h"
#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"
@@ -365,7 +367,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);
@@ -373,18 +375,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;