mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 13:53:38 +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;
|
||||
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
|
||||
IDXGIAdapter1* capableAdapter = nullptr;
|
||||
{
|
||||
|
@ -77,21 +82,21 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
break;
|
||||
}
|
||||
// query to see if there exists a corresponding compute device
|
||||
|
||||
// if so, mark it as the one against which to create our d3d10 device
|
||||
capableAdapter = pAdapter;
|
||||
capableAdapter->AddRef();
|
||||
|
||||
pAdapter->Release();
|
||||
}
|
||||
}
|
||||
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
capableAdapter->GetDesc1(&adapterDesc);
|
||||
pAdapter->GetDesc1(&adapterDesc);
|
||||
pAdapter->Release();
|
||||
|
||||
capableAdapter->Release();
|
||||
qCDebug(shared) << "Found adapter: " << adapterDesc.Description;
|
||||
|
||||
adapterDescs.push_back(adapterDesc);
|
||||
|
||||
}
|
||||
}
|
||||
pFactory->Release();
|
||||
|
||||
|
||||
|
||||
|
||||
// COM must be initialized already using CoInitialize. E.g., by the audio subsystem.
|
||||
CComPtr<IWbemLocator> spLoc = NULL;
|
||||
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);
|
||||
}
|
||||
|
||||
if (adapterDescs.size()) {
|
||||
const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||
_dedicatedMemoryMB = (uint64_t)(adapterDesc.DedicatedVideoMemory / BYTES_PER_MEGABYTE);
|
||||
|
||||
_dedicatedMemoryMB = (uint64_t)(adapterDescs[0].DedicatedVideoMemory / BYTES_PER_MEGABYTE);
|
||||
}
|
||||
|
||||
#endif
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue