cl21: Fix Issue #35 - ask for capability size. Too small size could cause errors (#96)

* Fix Issue #35 - ask for capability size. Too small size could cause errors

* Fix Issue #35 - Review fixes

* Fix Issue #35 - Review fixes - build issues fixed
This commit is contained in:
Grzegorz Wawiorko
2019-05-23 19:19:51 +02:00
committed by Kévin Petit
parent bfb3e4aa2c
commit fa312ab953
5 changed files with 52 additions and 31 deletions

View File

@@ -703,18 +703,22 @@ test_status InitCL( cl_device_id device )
gIsRTZ = 1;
}
char extensions[2048] = "";
if( (error = clGetDeviceInfo( device, CL_DEVICE_EXTENSIONS, sizeof( extensions ), extensions, NULL ) ) )
{
vlog_error( "FAILURE: unable to get device info for CL_DEVICE_EXTENSIONS!" );
return TEST_FAIL;
}
else if( strstr( extensions, "cl_khr_fp64" ) )
else if(is_extension_available(device, "cl_khr_fp64"))
{
gHasDouble = 1;
}
gTestDouble &= gHasDouble;
//detect whether profile of the device is embedded
char profile[1024] = "";
if( (error = clGetDeviceInfo( device, CL_DEVICE_PROFILE, sizeof(profile), profile, NULL ) ) ){}
else if( strstr(profile, "EMBEDDED_PROFILE" ) )
{
gIsEmbedded = 1;
if( !is_extension_available(device, "cles_khr_int64" ) )
gHasLong = 0;
}
gContext = clCreateContext( NULL, 1, &device, notify_callback, NULL, &error );
if( NULL == gContext || error )