diff --git a/src/detection/opencl/opencl.c b/src/detection/opencl/opencl.c index cb5176257..71e89a36e 100644 --- a/src/detection/opencl/opencl.c +++ b/src/detection/opencl/opencl.c @@ -15,8 +15,10 @@ #define CL_TARGET_OPENCL_VERSION 110 #ifndef __APPLE__ #include + #include #else #include + #include #endif typedef struct OpenCLData @@ -31,8 +33,23 @@ static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result) { cl_platform_id platforms[32]; cl_uint numPlatforms = 0; - if (data->ffclGetPlatformIDs(sizeof(platforms) / sizeof(platforms[0]), platforms, &numPlatforms) != CL_SUCCESS) - return "clGetPlatformIDs() failed"; + cl_int ret = data->ffclGetPlatformIDs(sizeof(platforms) / sizeof(platforms[0]), platforms, &numPlatforms); + if (ret != CL_SUCCESS) + { + switch (ret) + { + #ifdef CL_PLATFORM_NOT_FOUND_KHR // not available on macOS + case CL_PLATFORM_NOT_FOUND_KHR: + return "clGetPlatformIDs() failed: CL_PLATFORM_NOT_FOUND_KHR"; + #endif + case CL_INVALID_VALUE: + return "clGetPlatformIDs() failed: CL_INVALID_VALUE"; + case CL_OUT_OF_HOST_MEMORY: + return "clGetPlatformIDs() failed: CL_OUT_OF_HOST_MEMORY"; + default: + return "clGetPlatformIDs() failed: unknown error"; + } + } if (numPlatforms == 0) return "clGetPlatformIDs returned 0 platforms";