From 690de795803c345dc4916148f016b661c2e634e7 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 20 Dec 2011 17:36:56 +0000 Subject: 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. --- intern/cycles/device/device.cpp | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'intern/cycles/device/device.cpp') 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& tasks, int num) +void DeviceTask::split_max_size(list& 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& queue, int num) +{ + list tasks; + split(tasks, num); + + foreach(DeviceTask& task, tasks) + queue.push(task); +} + +void DeviceTask::split(list& tasks, int num) { if(type == DISPLACE) { num = min(displace_w, num); @@ -55,7 +80,7 @@ void DeviceTask::split(ThreadQueue& 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& tasks, int num) task.y = ty; task.h = th; - tasks.push(task); + tasks.push_back(task); } } } -- cgit v1.2.3