]> granicus.if.org Git - imagemagick/commitdiff
OpenCL fixes.
authordirk <dirk@git.imagemagick.org>
Tue, 10 Dec 2013 22:36:32 +0000 (22:36 +0000)
committerdirk <dirk@git.imagemagick.org>
Tue, 10 Dec 2013 22:36:32 +0000 (22:36 +0000)
MagickCore/opencl.c

index 65cfe465a45e322571254abb8bd8de1709622064..b4d9c859e4252e6ace308e3308f69798a24cfb45 100644 (file)
@@ -1339,7 +1339,7 @@ static ds_status initDSProfile(ds_profile** p, const char* version) {
     clGetPlatformIDs(numPlatforms, platforms, NULL);
     for (i = 0; i < (unsigned int)numPlatforms; i++) {
       cl_uint num;
-      clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &num);
+      clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_CPU | CL_DEVICE_TYPE_GPU, 0, NULL, &num);
       numDevices+=num;
     }
   }
@@ -1378,23 +1378,24 @@ static ds_status initDSProfile(ds_profile** p, const char* version) {
           continue;
           break;
         }
-        clGetDeviceIDs(platforms[i], deviceType, numDevices, devices, &num);
+        if (clGetDeviceIDs(platforms[i], deviceType, numDevices, devices, &num) != CL_SUCCESS)
+          continue;
         for (j = 0; j < num; j++, next++) {
           size_t length;
 
           profile->devices[next].type = DS_DEVICE_OPENCL_DEVICE;
           profile->devices[next].oclDeviceID = devices[j];
 
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME\r
-            , 0, NULL, &length);\r
-          profile->devices[next].oclDeviceName = (char*)malloc(sizeof(char)*length);\r
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME\r
-            , length, profile->devices[next].oclDeviceName, NULL);\r
-\r
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION\r
-            , 0, NULL, &length);\r
-          profile->devices[next].oclDriverVersion = (char*)malloc(sizeof(char)*length);\r
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION\r
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME
+            , 0, NULL, &length);
+          profile->devices[next].oclDeviceName = (char*)malloc(sizeof(char)*length);
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME
+            , length, profile->devices[next].oclDeviceName, NULL);
+
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION
+            , 0, NULL, &length);
+          profile->devices[next].oclDriverVersion = (char*)malloc(sizeof(char)*length);
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION
             , length, profile->devices[next].oclDriverVersion, NULL);
 
           clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_MAX_CLOCK_FREQUENCY