diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-08 22:58:07 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-09-08 22:58:07 +0400 |
commit | 9b31cba74e2bd84e9988ebdab723e6e43f9b8357 (patch) | |
tree | fb8e8e539247f916784fb967387641f7a9291ace /intern/cycles/device | |
parent | 6b134ae357188358f1437650924ab38886386860 (diff) |
Cycles: some warning fixes, cpu device task tweaks, avoid unnecessary
tonemap in non-viewport render, and some utility functions.
Diffstat (limited to 'intern/cycles/device')
-rw-r--r-- | intern/cycles/device/device.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
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<DeviceTask>& 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<DeviceTask>& 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() |