Cycles: Enable OpenCL rendering on Apple OSX
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 15 Jul 2015 09:16:12 +0000 (11:16 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 15 Jul 2015 12:20:59 +0000 (14:20 +0200)
Requires having latest El Capitan beta 3 OSX due to ome crucial fixes made in the
compiler. Supports same features as NVidia OpenCL apart from CMJ (there's no
experimental feature set support in megakernel yet).

Uses megakernel internally, which works much better than the split kernel. Split
kernel is not supported on OSX still, needs to be investigated still.

Some more details can be found there:

  http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/OpenCL#AMD_on_OSX

intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/kernel_types.h

index 367c5f3198404988f318abb860db6ec624f11259..8df831161959af6c39bee4a7f3dcdd4166c865ab 100644 (file)
@@ -115,12 +115,14 @@ bool opencl_kernel_use_advanced_shading(const string& platform)
        if(platform == "NVIDIA CUDA")
                return true;
        else if(platform == "Apple")
-               return false;
+               return true;
        else if(platform == "AMD Accelerated Parallel Processing")
                return true;
        else if(platform == "Intel(R) OpenCL")
                return true;
-
+       /* Make sure officially unsupported OpenCL platforms
+        * does not set up to use advanced shading.
+        */
        return false;
 }
 
index 3f57d009c5086d5c269f15fa2d15eb69d88c776e..46e5d6b2a311b250579555a9a2e94aae9c221169 100644 (file)
@@ -105,7 +105,14 @@ CCL_NAMESPACE_BEGIN
 
 #ifdef __KERNEL_OPENCL_APPLE__
 #  define __KERNEL_SHADING__
-//#define __KERNEL_ADV_SHADING__
+#  define __KERNEL_ADV_SHADING__
+/* TODO(sergey): Currently experimental section is ignored here,
+ * this is because megakernel in device_opencl does not support
+ * custom cflags depending on the scene features.
+ */
+#  ifdef __KERNEL_EXPERIMENTAL__
+#    define __CMJ__
+#  endif
 #endif
 
 #ifdef __KERNEL_OPENCL_AMD__