Refactored platform extensions and added two queries
@@ -120,6 +120,34 @@ static const char *pocl_version
#endif
;
+static const cl_name_version pocl_platform_extensions[] = {
+#ifdef BUILD_ICD
+ { CL_MAKE_VERSION (1, 0, 0), "cl_khr_icd" },
+#endif
+ { CL_MAKE_VERSION (1, 0, 0), "cl_pocl_content_size" }
+};
+static const size_t pocl_platform_extensions_num
+ = sizeof (pocl_platform_extensions) / sizeof (cl_name_version);
+
+char *
+pocl_cl_name_version_to_str (cl_name_version *arr, size_t arr_size)
+{
+ if (arr_size == 0)
+ {
+ return "";
+ }
+ char str[(CL_NAME_VERSION_MAX_NAME_SIZE + 1) * arr_size];
+ char *str_ptr = str;
+ strcpy (str, arr[0].name);
+ size_t i;
+ for (i = 1; i < arr_size; ++i)
+ {
+ strcat (str, " ");
+ strcat (str, arr[i].name);
+ }
+ return str_ptr;
+}
+
CL_API_ENTRY cl_int CL_API_CALL
POname(clGetPlatformInfo)(cl_platform_id platform,
cl_platform_info param_name,
@@ -146,6 +174,14 @@ POname(clGetPlatformInfo)(cl_platform_id platform,
POCL_RETURN_GETINFO_STR (pocl_version);
+ case CL_PLATFORM_NUMERIC_VERSION:
+ // Let's asume that only single digit is used for major and minor
+ // versioning , and there is no patch.
+ POCL_RETURN_GETINFO (cl_version,
+ CL_MAKE_VERSION ((cl_uint)POCL_CL_VERSION[0],
+ (cl_uint)POCL_CL_VERSION[2],
+ 0));
+
case CL_PLATFORM_NAME:
POCL_RETURN_GETINFO_STR("Portable Computing Language");
@@ -153,11 +189,13 @@ POname(clGetPlatformInfo)(cl_platform_id platform,
POCL_RETURN_GETINFO_STR("The pocl project");
case CL_PLATFORM_EXTENSIONS:
- POCL_RETURN_GETINFO_STR (
-#ifdef BUILD_ICD
- "cl_khr_icd"
-#endif
- " cl_pocl_content_size");
+ POCL_RETURN_GETINFO_STR (pocl_cl_name_version_to_str (
+ pocl_platform_extensions, pocl_platform_extensions_num));
+
+ case CL_PLATFORM_EXTENSIONS_WITH_VERSION:
+ POCL_RETURN_GETINFO_ARRAY (cl_name_version,
+ pocl_platform_extensions_num,
+ pocl_platform_extensions);
case CL_PLATFORM_ICD_SUFFIX_KHR:
POCL_RETURN_GETINFO_STR("POCL");
