[Bf-blender-cvs] [bf43633] blender-v2.75-release: Cycles: Add an option to force disable all OpenCL devices

Sergey Sharybin noreply at git.blender.org
Tue Jul 7 15:17:47 CEST 2015


Commit: bf43633840eb9185284d09a373811365e3a3b69d
Author: Sergey Sharybin
Date:   Tue Jul 7 14:17:41 2015 +0200
Branches: blender-v2.75-release
https://developer.blender.org/rBbf43633840eb9185284d09a373811365e3a3b69d

Cycles: Add an option to force disable all OpenCL devices

This way it's possible to disable OpenCL devices for AMD devices
which are considered whitelisted.

===================================================================

M	intern/cycles/device/device_opencl.cpp

===================================================================

diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 14c65e4..0bf6818 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -77,6 +77,8 @@ cl_device_type opencl_device_type()
 	char *device = getenv("CYCLES_OPENCL_TEST");
 
 	if(device) {
+		if(strcmp(device, "NONE") == 0)
+			return 0;
 		if(strcmp(device, "ALL") == 0)
 			return CL_DEVICE_TYPE_ALL;
 		else if(strcmp(device, "DEFAULT") == 0)
@@ -211,6 +213,10 @@ void opencl_get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices)
 	        (getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST")) != NULL;
 	const cl_device_type device_type = opencl_device_type();
 
+	if(device_type == 0) {
+		return;
+	}
+
 	vector<cl_device_id> device_ids;
 	cl_uint num_devices = 0;
 	vector<cl_platform_id> platform_ids;
@@ -3441,6 +3447,9 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 
 string device_opencl_capabilities(void)
 {
+	if(opencl_device_type() == 0) {
+		return "All OpenCL devices are forced to be OFF";
+	}
 	string result = "";
 	string error_msg = "";  /* Only used by opencl_assert(), but in the future
 	                         * it could also be nicely reported to the console.




More information about the Bf-blender-cvs mailing list