Cycles: Apparently board name could be an empty string

This commit is contained in:
Sergey Sharybin 2017-04-10 15:31:21 +02:00
parent 3b4cc5dfed
commit 9539cfacca
1 changed files with 5 additions and 2 deletions

View File

@ -1058,13 +1058,16 @@ cl_device_type OpenCLInfo::get_device_type(cl_device_id device_id)
string OpenCLInfo::get_readable_device_name(cl_device_id device_id)
{
char board_name[1024];
size_t length = 0;
if(clGetDeviceInfo(device_id,
CL_DEVICE_BOARD_NAME_AMD,
sizeof(board_name),
&board_name,
NULL) == CL_SUCCESS)
&length) == CL_SUCCESS)
{
return board_name;
if(length != 0 && board_name[0] != '\0') {
return board_name;
}
}
/* Fallback to standard device name API. */
return get_device_name(device_id);