diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-21 19:58:59 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-10-21 21:13:44 +0300 |
commit | dc9eb8234fe4c9c561a3bfb9a8e3a3cefe77d5e3 (patch) | |
tree | b5d93ce6d13577a8d922b2675dbc7b55b1557f01 /intern/cycles/device/device_cpu.cpp | |
parent | efd70ab78f0c0d9288508fd28988c969a0cbd31a (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_cpu.cpp')
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index a17caabc850..af1bbc0db18 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -207,8 +207,8 @@ public: KERNEL_NAME_EVAL(cpu_avx, name), \ KERNEL_NAME_EVAL(cpu_avx2, name) - CPUDevice(DeviceInfo& info, Stats &stats, bool background) - : Device(info, stats, background), + CPUDevice(DeviceInfo& info_, Stats &stats_, bool background_) + : Device(info_, stats_, background_), #define REGISTER_KERNEL(name) name ## _kernel(KERNEL_FUNCTIONS(name)) REGISTER_KERNEL(path_trace), REGISTER_KERNEL(convert_to_half_float), @@ -229,6 +229,9 @@ public: REGISTER_KERNEL(data_init) #undef REGISTER_KERNEL { + if(info.cpu_threads == 0) { + info.cpu_threads = TaskScheduler::num_threads(); + } #ifdef WITH_OSL kernel_globals.osl = &osl_globals; @@ -237,7 +240,6 @@ public: if(use_split_kernel) { VLOG(1) << "Will be using split kernel."; } - need_texture_info = false; #define REGISTER_SPLIT_KERNEL(name) split_kernels[#name] = KernelFunctions<void(*)(KernelGlobals*, KernelData*)>(KERNEL_FUNCTIONS(name)) @@ -271,7 +273,7 @@ public: virtual bool show_samples() const { - return (TaskScheduler::num_threads() == 1); + return (info.cpu_threads == 1); } void load_texture_info() @@ -826,9 +828,9 @@ public: int get_split_task_count(DeviceTask& task) { if(task.type == DeviceTask::SHADER) - return task.get_subtask_count(TaskScheduler::num_threads(), 256); + return task.get_subtask_count(info.cpu_threads, 256); else - return task.get_subtask_count(TaskScheduler::num_threads()); + return task.get_subtask_count(info.cpu_threads); } void task_add(DeviceTask& task) @@ -840,9 +842,9 @@ public: list<DeviceTask> tasks; if(task.type == DeviceTask::SHADER) - task.split(tasks, TaskScheduler::num_threads(), 256); + task.split(tasks, info.cpu_threads, 256); else - task.split(tasks, TaskScheduler::num_threads()); + task.split(tasks, info.cpu_threads); foreach(DeviceTask& task, tasks) task_pool.push(new CPUDeviceTask(this, task)); |