implement clCreateContextFromType()
authorLu Guanqun <guanqun.lu@intel.com>
Fri, 22 Mar 2013 08:07:43 +0000 (16:07 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 10 Apr 2013 06:52:33 +0000 (14:52 +0800)
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
src/cl_api.c

index cedd3ff..61a00d1 100644 (file)
@@ -109,8 +109,26 @@ clCreateContextFromType(const cl_context_properties *  properties,
                         void *                         user_data,
                         cl_int *                       errcode_ret)
 {
-  NOT_IMPLEMENTED;
-  return NULL;
+  cl_device_id devices[1];
+  cl_uint num_devices = 1;
+  cl_int err;
+
+  err = cl_get_device_ids(NULL,
+                          device_type,
+                          1,
+                          &devices[0],
+                          &num_devices);
+  if (err != CL_SUCCESS) {
+    *errcode_ret = err;
+    return NULL;
+  }
+
+  return cl_create_context(properties,
+                           num_devices,
+                           devices,
+                           pfn_notify,
+                           user_data,
+                           errcode_ret);
 }
 
 cl_int