GPU: support detect gpu devices with OpenCL

This commit is contained in:
李通洲
2024-06-20 14:05:38 +08:00
parent 6737896038
commit 6318668d0b
8 changed files with 119 additions and 107 deletions
+11
View File
@@ -1,5 +1,6 @@
#include "gpu.h"
#include "detection/vulkan/vulkan.h"
#include "detection/opencl/opencl.h"
#include "detection/opengl/opengl.h"
const char* FF_GPU_VENDOR_NAME_APPLE = "Apple";
@@ -94,6 +95,16 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result)
return NULL;
}
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_OPENCL)
{
FFOpenCLResult* opencl = ffDetectOpenCL();
if (!opencl->error && opencl->gpus.length > 0)
{
ffListDestroy(result);
ffListInitMove(result, &opencl->gpus);
return NULL;
}
}
if (options->detectionMethod <= FF_GPU_DETECTION_METHOD_OPENGL)
{
if (detectByOpenGL(result) == NULL)