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/blender
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/blender')
-rw-r--r--intern/cycles/blender/addon/properties.py15
-rw-r--r--intern/cycles/blender/blender_sync.cpp45
2 files changed, 45 insertions, 15 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 7b16ef1d543..2e149527066 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1351,8 +1351,9 @@ class CyclesPreferences(bpy.types.AddonPreferences):
cuda_devices = []
opencl_devices = []
+ cpu_devices = []
for device in device_list:
- if not device[1] in {'CUDA', 'OPENCL'}:
+ if not device[1] in {'CUDA', 'OPENCL', 'CPU'}:
continue
entry = None
@@ -1361,18 +1362,28 @@ class CyclesPreferences(bpy.types.AddonPreferences):
if dev.id == device[2] and dev.type == device[1]:
entry = dev
break
- # Create new entry if no existing one was found
if not entry:
+ # Create new entry if no existing one was found
entry = self.devices.add()
entry.id = device[2]
entry.name = device[0]
entry.type = device[1]
+ entry.use = entry.type != 'CPU'
+ elif entry.name != device[0]:
+ # Update name in case it changed
+ entry.name = device[0]
# Sort entries into lists
if entry.type == 'CUDA':
cuda_devices.append(entry)
elif entry.type == 'OPENCL':
opencl_devices.append(entry)
+ else:
+ cpu_devices.append(entry)
+
+ cuda_devices.extend(cpu_devices)
+ opencl_devices.extend(cpu_devices)
+
return cuda_devices, opencl_devices
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 2e3301c4209..5eddf189468 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -675,6 +675,15 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
/* feature set */
params.experimental = (get_enum(cscene, "feature_set") != 0);
+ /* threads */
+ if(b_scene.render().threads_mode() == BL::RenderSettings::threads_mode_FIXED)
+ params.threads = b_scene.render().threads();
+ else
+ params.threads = 0;
+
+ /* Background */
+ params.background = background;
+
/* device type */
vector<DeviceInfo>& devices = Device::available_devices();
@@ -703,12 +712,28 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
}
}
- int compute_device = get_enum(b_preferences, "compute_device_type");
+ enum ComputeDevice {
+ COMPUTE_DEVICE_CPU = 0,
+ COMPUTE_DEVICE_CUDA = 1,
+ COMPUTE_DEVICE_OPENCL = 2,
+ COMPUTE_DEVICE_NUM = 3,
+ };
- if(compute_device != 0) {
+ ComputeDevice compute_device = (ComputeDevice)get_enum(b_preferences,
+ "compute_device_type",
+ COMPUTE_DEVICE_NUM,
+ COMPUTE_DEVICE_CPU);
+
+ if(compute_device != COMPUTE_DEVICE_CPU) {
vector<DeviceInfo> used_devices;
RNA_BEGIN(&b_preferences, device, "devices") {
- if(get_enum(device, "type") == compute_device && get_boolean(device, "use")) {
+ ComputeDevice device_type = (ComputeDevice)get_enum(device,
+ "type",
+ COMPUTE_DEVICE_NUM,
+ COMPUTE_DEVICE_CPU);
+
+ if(get_boolean(device, "use") &&
+ (device_type == compute_device || device_type == COMPUTE_DEVICE_CPU)) {
string id = get_string(device, "id");
foreach(DeviceInfo& info, devices) {
if(info.id == id) {
@@ -723,15 +748,14 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.device = used_devices[0];
}
else if(used_devices.size() > 1) {
- params.device = Device::get_multi_device(used_devices);
+ params.device = Device::get_multi_device(used_devices,
+ params.threads,
+ params.background);
}
/* Else keep using the CPU device that was set before. */
}
}
- /* Background */
- params.background = background;
-
/* samples */
int samples = get_int(cscene, "samples");
int aa_samples = get_int(cscene, "aa_samples");
@@ -791,15 +815,10 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.tile_order = TILE_BOTTOM_TO_TOP;
}
+ /* other parameters */
params.start_resolution = get_int(cscene, "preview_start_resolution");
params.pixel_size = b_engine.get_preview_pixel_size(b_scene);
- /* other parameters */
- if(b_scene.render().threads_mode() == BL::RenderSettings::threads_mode_FIXED)
- params.threads = b_scene.render().threads();
- else
- params.threads = 0;
-
params.cancel_timeout = (double)get_float(cscene, "debug_cancel_timeout");
params.reset_timeout = (double)get_float(cscene, "debug_reset_timeout");
params.text_timeout = (double)get_float(cscene, "debug_text_timeout");