diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-20 21:36:56 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-20 21:36:56 +0400 |
commit | 690de795803c345dc4916148f016b661c2e634e7 (patch) | |
tree | bd044d59405a438deece51480f6a29ab229c487d /intern/cycles/device/device.cpp | |
parent | 738fdc7b6f43c3e1e838bd4239b36340fa4c2e0f (diff) |
Cycles: some tweaks for apple opencl with ATI cards, to get it working up to
the level of ambient occlusion render, shaders still fail. Fixes found with
much help from Jens and Dalai.
Diffstat (limited to 'intern/cycles/device/device.cpp')
-rw-r--r-- | intern/cycles/device/device.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index f43ccffe461..6ebc359fdb3 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_foreach.h" #include "util_math.h" #include "util_opencl.h" #include "util_opengl.h" @@ -41,7 +42,31 @@ DeviceTask::DeviceTask(Type type_) { } -void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num) +void DeviceTask::split_max_size(list<DeviceTask>& tasks, int max_size) +{ + int num; + + if(type == DISPLACE) { + num = (displace_w + max_size - 1)/max_size; + } + else { + max_size = max(1, max_size/w); + num = (h + max_size - 1)/max_size; + } + + split(tasks, num); +} + +void DeviceTask::split(ThreadQueue<DeviceTask>& queue, int num) +{ + list<DeviceTask> tasks; + split(tasks, num); + + foreach(DeviceTask& task, tasks) + queue.push(task); +} + +void DeviceTask::split(list<DeviceTask>& tasks, int num) { if(type == DISPLACE) { num = min(displace_w, num); @@ -55,7 +80,7 @@ void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num) task.displace_x = tx; task.displace_w = tw; - tasks.push(task); + tasks.push_back(task); } } else { @@ -70,7 +95,7 @@ void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num) task.y = ty; task.h = th; - tasks.push(task); + tasks.push_back(task); } } } |