diff options
author | Lu Guanqun <guanqun.lu@intel.com> | 2013-03-25 11:04:19 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-04-10 14:52:33 +0800 |
commit | 7717541b658b90746c3e82128b13deac299d991b (patch) | |
tree | 285e57bfff448be7cd8a4d333f0d70f4c218a024 /src/cl_platform_id.c | |
parent | a469372ccd3a9affc1fef8e5c19f505d184244e0 (diff) |
enhance clGetPlatformInfo() API to return the string length
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/cl_platform_id.c')
-rw-r--r-- | src/cl_platform_id.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cl_platform_id.c b/src/cl_platform_id.c index 6db27d33..900da3e4 100644 --- a/src/cl_platform_id.c +++ b/src/cl_platform_id.c @@ -78,6 +78,12 @@ cl_get_platform_ids(cl_uint num_entries, intel_platform->JOIN(FIELD,_sz)); \ return CL_SUCCESS; +#define GET_FIELD_SZ(CASE,FIELD) \ + case JOIN(CL_,CASE): \ + if (param_value_size_ret != NULL) \ + *param_value_size_ret = intel_platform->JOIN(FIELD,_sz); \ + return CL_SUCCESS; + LOCAL cl_int cl_get_platform_into(cl_platform_id platform, cl_platform_info param_name, @@ -88,8 +94,17 @@ cl_get_platform_into(cl_platform_id platform, /* Only one platform. This is easy */ if (UNLIKELY(platform != NULL && platform != intel_platform)) return CL_INVALID_PLATFORM; - if (UNLIKELY(param_value == NULL)) - return CL_INVALID_VALUE; + + if (param_value == NULL) { + switch (param_name) { + GET_FIELD_SZ (PLATFORM_PROFILE, profile); + GET_FIELD_SZ (PLATFORM_VERSION, version); + GET_FIELD_SZ (PLATFORM_NAME, name); + GET_FIELD_SZ (PLATFORM_VENDOR, vendor); + GET_FIELD_SZ (PLATFORM_EXTENSIONS, extensions); + default: return CL_INVALID_VALUE; + } + } /* Fetch the platform inform */ switch (param_name) { |