From 32fb1479eb75234d478edf7b388ea213771eef78 Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Fri, 22 Mar 2013 16:07:43 +0800 Subject: [PATCH] implement clCreateContextFromType() Signed-off-by: Lu Guanqun Reviewed-by: Zhigang Gong --- src/cl_api.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/cl_api.c b/src/cl_api.c index cedd3ff..61a00d1 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -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 -- 2.7.4