2022-10-05 17:53:18 +08:00
|
|
|
extern "C" {
|
|
|
|
|
#include "gpu.h"
|
|
|
|
|
}
|
|
|
|
|
#include "util/windows/wmi.hpp"
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
|
|
|
|
|
{
|
|
|
|
|
FF_UNUSED(instance);
|
|
|
|
|
|
2022-10-16 23:58:13 +08:00
|
|
|
FFWmiQuery query(L"SELECT Name, AdapterCompatibility, DriverVersion FROM Win32_VideoController", nullptr);
|
|
|
|
|
if(!query)
|
2022-10-05 17:53:18 +08:00
|
|
|
return "Query WMI service failed";
|
|
|
|
|
|
2022-10-16 23:58:13 +08:00
|
|
|
while(FFWmiRecord record = query.next())
|
2022-10-05 17:53:18 +08:00
|
|
|
{
|
|
|
|
|
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
|
|
|
|
|
|
|
|
|
ffStrbufInit(&gpu->vendor);
|
2022-10-16 23:58:13 +08:00
|
|
|
record.getString(L"AdapterCompatibility", &gpu->vendor);
|
2022-10-05 17:53:18 +08:00
|
|
|
if(ffStrbufStartsWithS(&gpu->vendor, "Intel "))
|
|
|
|
|
{
|
|
|
|
|
//Intel returns "Intel Corporation", not sure about AMD
|
|
|
|
|
ffStrbufSetS(&gpu->vendor, "Intel");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ffStrbufInit(&gpu->name);
|
2022-10-16 23:58:13 +08:00
|
|
|
record.getString(L"Name", &gpu->name);
|
2022-10-05 17:53:18 +08:00
|
|
|
|
|
|
|
|
ffStrbufInit(&gpu->driver);
|
2022-10-16 23:58:13 +08:00
|
|
|
record.getString(L"DriverVersion", &gpu->driver);
|
2022-10-05 17:53:18 +08:00
|
|
|
|
|
|
|
|
gpu->temperature = FF_GPU_TEMP_UNSET;
|
|
|
|
|
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|