Cycles: use workgroup size from opencl, attempt to fix issue with apple opencl.

This commit is contained in:
Brecht Van Lommel 2011-09-05 12:24:28 +00:00
parent f3ee10ce5c
commit 7d9d9fa976
2 changed files with 27 additions and 2 deletions

@ -26,6 +26,7 @@
#include "device_intern.h"
#include "util_map.h"
#include "util_math.h"
#include "util_opencl.h"
#include "util_opengl.h"
#include "util_path.h"
@ -412,7 +413,14 @@ public:
opencl_assert(ciErr);
size_t local_size[2] = {8, 8};
size_t workgroup_size;
clGetKernelWorkGroupInfo(ckPathTraceKernel, cdDevice,
CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &workgroup_size, NULL);
workgroup_size = max(sqrt((double)workgroup_size), 1.0);
size_t local_size[2] = {workgroup_size, workgroup_size};
size_t global_size[2] = {global_size_round_up(local_size[0], d_w), global_size_round_up(local_size[1], d_h)};
/* run kernel */
@ -480,7 +488,14 @@ public:
opencl_assert(ciErr);
size_t local_size[2] = {8, 8};
size_t workgroup_size;
clGetKernelWorkGroupInfo(ckFilmConvertKernel, cdDevice,
CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &workgroup_size, NULL);
workgroup_size = max(sqrt((double)workgroup_size), 1.0);
size_t local_size[2] = {workgroup_size, workgroup_size};
size_t global_size[2] = {global_size_round_up(local_size[0], d_w), global_size_round_up(local_size[1], d_h)};
/* run kernel */

@ -101,6 +101,16 @@ __device_inline float min(float a, float b)
return (a < b)? a: b;
}
__device_inline double max(double a, double b)
{
return (a > b)? a: b;
}
__device_inline double min(double a, double b)
{
return (a < b)? a: b;
}
#endif
__device_inline float min4(float a, float b, float c, float d)