Revision: 41771
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41771
Author:   dingto
Date:     2011-11-12 22:22:00 +0000 (Sat, 12 Nov 2011)
Log Message:
-----------
OpenCL/Nvidia:
* Enable OpenCL Full Shading on NVIDIA cards.

Notes:
It makes not much sense to use OpenCL on a nVidia card (as it is slower 
compared to CUDA), but as OpenCL comes without dependencies, it's an good 
alternative if you don't want to install the CUDA toolkit or the build comes 
without CUDA kernels. 

Modified Paths:
--------------
    trunk/blender/intern/cycles/device/device_opencl.cpp

Modified: trunk/blender/intern/cycles/device/device_opencl.cpp
===================================================================
--- trunk/blender/intern/cycles/device/device_opencl.cpp        2011-11-12 
19:08:16 UTC (rev 41770)
+++ trunk/blender/intern/cycles/device/device_opencl.cpp        2011-11-12 
22:22:00 UTC (rev 41771)
@@ -177,6 +177,7 @@
        bool opencl_version_check()
        {
                char version[256];
+
                int major, minor, req_major = 1, req_minor = 1;
 
                clGetPlatformInfo(cpPlatform, CL_PLATFORM_VERSION, 
sizeof(version), &version, NULL);
@@ -265,7 +266,21 @@
 
                build_options += "-I " + kernel_path + ""; /* todo: escape path 
*/
                build_options += " -cl-fast-relaxed-math ";
+               
+               /* Full Shading only on NVIDIA cards at the moment */
+               char vendor[256];
 
+               clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), 
&vendor, NULL);
+               string name = vendor;
+               
+               if (name == "NVIDIA CUDA") {
+                       build_options += "-D __SVM__ ";
+                       build_options += "-D __EMISSION__ ";
+                       build_options += "-D __TEXTURES__ ";
+                       build_options += "-D __HOLDOUT__ ";
+                       build_options += "-D __MULTI_CLOSURE__ ";
+               }
+
                ciErr = clBuildProgram(cpProgram, 0, NULL, 
build_options.c_str(), NULL, NULL);
 
                if(ciErr != CL_SUCCESS) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to