GPU: detect type based on vendor

This commit is contained in:
李通洲
2023-01-13 15:44:52 +08:00
parent 67ab7c0779
commit dcf04aa4fe
+12
View File
@@ -67,13 +67,25 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId))
{
if(vendorId == 0x106b)
{
ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_APPLE);
gpu->type = FF_GPU_TYPE_INTEGRATED;
}
else if(wmemchr((const wchar_t[]) {0x1002, 0x1022}, (wchar_t)vendorId, 2))
{
ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_AMD);
gpu->type = FF_GPU_TYPE_DISCRETE; // Apple never used AMD CPUs
}
else if(wmemchr((const wchar_t[]) {0x03e7, 0x8086, 0x8087}, (wchar_t)vendorId, 3))
{
ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_INTEL);
gpu->type = FF_GPU_TYPE_INTEGRATED;
}
else if(wmemchr((const wchar_t[]) {0x0955, 0x10de, 0x12d2}, (wchar_t)vendorId, 3))
{
ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_NVIDIA);
gpu->type = FF_GPU_TYPE_DISCRETE;
}
}
ffStrbufInit(&gpu->driver);