From 9b31cba74e2bd84e9988ebdab723e6e43f9b8357 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 8 Sep 2011 18:58:07 +0000 Subject: Cycles: some warning fixes, cpu device task tweaks, avoid unnecessary tonemap in non-viewport render, and some utility functions. --- intern/cycles/device/device.cpp | 5 +++++ intern/cycles/device/device_cpu.cpp | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'intern/cycles/device') diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index aed0be96229..e21dce45d80 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -24,6 +24,7 @@ #include "util_cuda.h" #include "util_debug.h" +#include "util_math.h" #include "util_opencl.h" #include "util_opengl.h" #include "util_types.h" @@ -43,6 +44,8 @@ DeviceTask::DeviceTask(Type type_) void DeviceTask::split(ThreadQueue& tasks, int num) { if(type == DISPLACE) { + num = min(displace_w, num); + for(int i = 0; i < num; i++) { int tx = displace_x + (displace_w/num)*i; int tw = (i == num-1)? displace_w - i*(displace_w/num): displace_w/num; @@ -56,6 +59,8 @@ void DeviceTask::split(ThreadQueue& tasks, int num) } } else { + num = min(h, num); + for(int i = 0; i < num; i++) { int ty = y + (h/num)*i; int th = (i == num-1)? h - i*(h/num): h/num; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 7066efee547..3a3ae685395 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -194,10 +194,9 @@ public: void task_add(DeviceTask& task) { - if(task.type == DeviceTask::TONEMAP) - tasks.push(task); - else - task.split(tasks, threads.size()); + /* split task into smaller ones, more than number of threads for uneven + workloads where some parts of the image render slower than others */ + task.split(tasks, threads.size()*10); } void task_wait() -- cgit v1.2.3