Ensure is_extension_available is used where possible (#721)

(Patch1)
A number of tests have got their own code for checking the presence of
extensions. This change replaces that code with is_extension_available
function.

Contributes to #627

Change-Id: I8dd2233719aa8c84841ac61776437d7f6e3fafe6
Signed-off-by: Ellen Norris-Thompson <ellen.norris-thompson@arm.com>
This commit is contained in:
ellnor01
2020-04-02 21:22:02 +01:00
committed by GitHub
parent aee0a22ad2
commit ef3528e78a
9 changed files with 16 additions and 205 deletions

View File

@@ -92,16 +92,9 @@ class OSXGLEnvironment : public GLEnvironment
return NULL;
}
char extensions[8192];
for (int i=0; i<(int)(size_out/sizeof(cl_device_id)); i++) {
error = clGetDeviceInfo(devices[i], CL_DEVICE_EXTENSIONS, sizeof(extensions), extensions, NULL);
if (error) {
print_error(error, "clGetDeviceInfo failed");
return NULL;
}
if (strstr(extensions, "cl_APPLE_gl_sharing") == NULL) {
log_error("Device %d does not supporte required extension cl_APPLE_gl_sharing.\n", i);
if (!is_extension_available(devices[i], "cl_APPLE_gl_sharing")) {
log_error("Device %d does not support required extension cl_APPLE_gl_sharing.\n", i);
return NULL;
}
}
@@ -120,15 +113,8 @@ class OSXGLEnvironment : public GLEnvironment
return -1;
}
char extensions[8192];
for (int i=0; i<(int)num_of_devices; i++) {
error = clGetDeviceInfo(devices[i], CL_DEVICE_EXTENSIONS, sizeof(extensions), extensions, NULL);
if (error) {
print_error(error, "clGetDeviceInfo failed");
return -1;
}
if (strstr(extensions, "cl_APPLE_gl_sharing") == NULL) {
if (!is_extension_available(devices[i], "cl_APPLE_gl_sharing")) {
log_info("Device %d of %d does not support required extension cl_APPLE_gl_sharing.\n", i, num_of_devices);
} else {
log_info("Device %d of %d does support required extension cl_APPLE_gl_sharing.\n", i, num_of_devices);