Fixed the extension string for both platform and device.
authorZhigang Gong <zhigang.gong@linux.intel.com>
Wed, 10 Apr 2013 11:23:41 +0000 (19:23 +0800)
committerZhigang Gong <zhigang.gong@linux.intel.com>
Fri, 12 Apr 2013 06:13:00 +0000 (14:13 +0800)
I forgot to calculate the extensions string size. Now fix it.
And also forgot to handle the device's extension case, now add
it and duplicate the extensions from the platform directly.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Lu, Guanqun <guanqun.lu@intel.com>
src/cl_device_id.c
src/cl_platform_id.c

index 4543921..8d47aa5 100644 (file)
@@ -117,6 +117,9 @@ cl_get_device_ids(cl_platform_id    platform,
   if (devices && UNLIKELY((*devices = cl_get_gt_device()) != NULL)) {
     if (num_devices)
       *num_devices = 1;
+
+    (*devices)->extensions = intel_platform->extensions;
+    (*devices)->extensions_sz = intel_platform->extensions_sz;
     return CL_SUCCESS;
   }
   else {
@@ -171,6 +174,7 @@ cl_get_device_info(cl_device_id     device,
       GET_STRING_FIELD_SIZE(VERSION, version)
       GET_STRING_FIELD_SIZE(PROFILE, profile)
       GET_STRING_FIELD_SIZE(OPENCL_C_VERSION, opencl_c_version)
+      GET_STRING_FIELD_SIZE(EXTENSIONS, extensions)
       default: return CL_INVALID_VALUE;
     }
   }
@@ -235,6 +239,7 @@ cl_get_device_info(cl_device_id     device,
     DECL_STRING_FIELD(VERSION, version)
     DECL_STRING_FIELD(PROFILE, profile)
     DECL_STRING_FIELD(OPENCL_C_VERSION, opencl_c_version)
+    DECL_STRING_FIELD(EXTENSIONS, extensions);
     default: return CL_INVALID_VALUE;
   };
 }
index 900da3e..0d46453 100644 (file)
@@ -64,6 +64,7 @@ cl_get_platform_ids(cl_uint          num_entries,
   cl_intel_platform_extension_init(intel_platform);
   /* Easy right now, only one platform is supported */
   *platforms = intel_platform;
+  intel_platform->extensions_sz = strlen(intel_platform->extensions) + 1;
   return CL_SUCCESS;
 }