mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
Start detecting all the gpus
This commit is contained in:
parent
861944ba71
commit
49f1590e01
1 changed files with 19 additions and 13 deletions
|
@ -65,7 +65,12 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
|
|
||||||
IDXGIFactory1* pFactory = nullptr;
|
IDXGIFactory1* pFactory = nullptr;
|
||||||
hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) );
|
hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) );
|
||||||
|
if (hr != S_OK || pFactory == nullptr) {
|
||||||
|
qCDebug(shared) << "Unable to create DXGI";
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DXGI_ADAPTER_DESC1> adapterDescs;
|
||||||
// Select our adapter
|
// Select our adapter
|
||||||
IDXGIAdapter1* capableAdapter = nullptr;
|
IDXGIAdapter1* capableAdapter = nullptr;
|
||||||
{
|
{
|
||||||
|
@ -77,21 +82,21 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// query to see if there exists a corresponding compute device
|
// query to see if there exists a corresponding compute device
|
||||||
|
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||||
// if so, mark it as the one against which to create our d3d10 device
|
pAdapter->GetDesc1(&adapterDesc);
|
||||||
capableAdapter = pAdapter;
|
|
||||||
capableAdapter->AddRef();
|
|
||||||
|
|
||||||
pAdapter->Release();
|
pAdapter->Release();
|
||||||
|
|
||||||
|
qCDebug(shared) << "Found adapter: " << adapterDesc.Description;
|
||||||
|
|
||||||
|
adapterDescs.push_back(adapterDesc);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
|
||||||
capableAdapter->GetDesc1(&adapterDesc);
|
|
||||||
|
|
||||||
capableAdapter->Release();
|
|
||||||
pFactory->Release();
|
pFactory->Release();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// COM must be initialized already using CoInitialize. E.g., by the audio subsystem.
|
// COM must be initialized already using CoInitialize. E.g., by the audio subsystem.
|
||||||
CComPtr<IWbemLocator> spLoc = NULL;
|
CComPtr<IWbemLocator> spLoc = NULL;
|
||||||
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc);
|
hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc);
|
||||||
|
@ -189,9 +194,10 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
||||||
hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances);
|
hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
if (adapterDescs.size()) {
|
||||||
_dedicatedMemoryMB = (uint64_t)(adapterDesc.DedicatedVideoMemory / BYTES_PER_MEGABYTE);
|
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||||
|
_dedicatedMemoryMB = (uint64_t)(adapterDescs[0].DedicatedVideoMemory / BYTES_PER_MEGABYTE);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue