From: Mario Kicherer Date: Mon, 6 May 2013 15:49:50 +0000 (+0200) Subject: enable clGetContextInfo with CL_CONTEXT_DEVICES X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec74bff6b413eb0a09d6094e6ad24dc6348f4642;p=contrib%2Fbeignet.git enable clGetContextInfo with CL_CONTEXT_DEVICES The following patch enables the clGetContextInfo query with CL_CONTEXT_DEVICES. Applications can query the required size of the result buffer and then request the cl_device_id of the available devices in this context. Signed-off-by: Mario Kicherer Reviewed-by: Zhigang Gong --- diff --git a/src/cl_api.c b/src/cl_api.c index 03cc0e6..c9aba20 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -159,7 +159,24 @@ clGetContextInfo(cl_context context, void * param_value, size_t * param_value_size_ret) { - NOT_IMPLEMENTED; + switch (param_name) { + case CL_CONTEXT_DEVICES: + if (param_value) { + if (param_value_size < sizeof(cl_device_id)) + return CL_INVALID_VALUE; + cl_device_id *device_list = (cl_device_id*)param_value; + device_list[0] = context->device; + if (param_value_size_ret) + *param_value_size_ret = sizeof(cl_device_id); + return CL_SUCCESS; + } + if (param_value_size_ret) { + *param_value_size_ret = sizeof(cl_device_id); + return CL_SUCCESS; + } + default: + NOT_IMPLEMENTED; + } return 0; }