[Bf-blender-cvs] [136d7a4] master: Cycles: Only whitelist AMD GPU devices in the OpenCL section

Sergey Sharybin noreply at git.blender.org
Sat May 9 20:41:43 CEST 2015


Commit: 136d7a4f6239308ba8b8533b31c3d2a21c4f43cc
Author: Sergey Sharybin
Date:   Sat May 9 23:40:26 2015 +0500
Branches: master
https://developer.blender.org/rB136d7a4f6239308ba8b8533b31c3d2a21c4f43cc

Cycles: Only whitelist AMD GPU devices in the OpenCL section

Only those ones are priority for now, all the rest are still testable
if CYCLES_OPENCL_TEST or CYCLES_OPENCL_SPLIT_KERNEL_TEST environment
variables are set.

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

M	intern/cycles/device/device_opencl.cpp

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

diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 25eb160..e342010 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -3346,6 +3346,10 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 	/* devices are numbered consecutively across platforms */
 	int num_base = 0;
 
+	const bool force_all_platforms =
+		(getenv("CYCLES_OPENCL_TEST") != NULL) ||
+		(getenv("CYCLES_OPENCL_SPLIT_KERNEL_TEST")) != NULL;
+
 	for(int platform = 0; platform < num_platforms; platform++, num_base += num_devices) {
 		num_devices = 0;
 		if(clGetDeviceIDs(platform_ids[platform], opencl_device_type(), 0, NULL, &num_devices) != CL_SUCCESS || num_devices == 0)
@@ -3360,6 +3364,17 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 		clGetPlatformInfo(platform_ids[platform], CL_PLATFORM_NAME, sizeof(pname), &pname, NULL);
 		string platform_name = pname;
 
+		cl_device_type device_type;
+		clGetDeviceInfo(device_ids[platform], CL_DEVICE_TYPE, sizeof(cl_device_type), &device_type, NULL);
+
+		/* TODO(sergey): Make it an utility function to check whitelisted devices. */
+		if(!(force_all_platforms ||
+		     (platform_name == "AMD Accelerated Parallel Processing" &&
+		      device_type == CL_DEVICE_TYPE_GPU)))
+		{
+			continue;
+		}
+
 		/* add devices */
 		for(int num = 0; num < num_devices; num++) {
 			cl_device_id device_id = device_ids[num];




More information about the Bf-blender-cvs mailing list