After doing some digging into Microsoft's documentation, I was able to find the DXCore library. This library allowed me to interop with DXGI and filter GPUs by type. This can be achieved like this:
IDXGIFactory1* factory = nullptr;
winrt::com_ptr<IDXCoreAdapterFactory> coreFactory;
HRESULT result = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory);
if (FAILED(result)) {
Log("Failed to create factory object.");
return;
}
if (FAILED(DXCoreCreateAdapterFactory(coreFactory.put()))) {
Log("Failed to create core factory object.");
return;
}
UINT index;
IDXGIAdapter1* adapter = nullptr;
winrt::com_ptr<IDXCoreAdapter> coreAdapter = nullptr;
while (factory->EnumAdapters1(index, &adapter) != DXGI_ERROR_NOT_FOUND) {
DXGI_ADAPTER_DESC desc;
adapter->GetDesc(&desc);
if (FAILED(coreFactory->GetAdapterByLuid(desc.AdapterLuid, coreAdapter.put()))) {
Log("Failed to get core adapter.");
adapter->Release();
++index;
continue;
}
if (!coreAdapter->IsPropertySupported(DXCoreAdapterProperty::IsIntegrated) || !coreAdapter->IsPropertySupported(DXCoreAdapterProperty::IsHardware)) {
Log("Adapter does not support required properties.");
adapter->Release();
++index;
continue;
}
bool isIntegrated;
bool isHardwareAdapter;
if (FAILED(coreAdapter->GetProperty(DXCoreAdapterProperty::IsIntegrated, &isIntegrated))) {
Log("Failed to get integrated property.");
adapter->Release();
++index;
continue;
}
if (FAILED(coreAdapter->GetProperty(DXCoreAdapterProperty::IsHardware, &isHardwareAdapter))) {
Log("Failed to get hardware property.");
adapter->Release();
++index;
continue;
}
if (!isHardwareAdapter) {
Log("Adapter is not a hardware adapter.");
adapter->Release();
++index;
continue;
}
if (isIntegrated) {
Log("Adapter is iGPU.");
adapter->Release();
++index;
continue;
}
}
Please let me know if there is any feedback on this approach! Worked for me with an AMD iGPU.