mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
OpenCL: print more detailed error messages
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
#define CL_TARGET_OPENCL_VERSION 110
|
||||
#ifndef __APPLE__
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_ext.h>
|
||||
#else
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
#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";
|
||||
|
||||
Reference in New Issue
Block a user