V
Vegan Fanatic
Guest
while working on some code to identify the graphics card, no major headache but when I have 2 of them on my box I figured it should not be too tricky to identify multiple video cards? I wish;
I have 1 EVGA and 1 BFG card, both are NVIDIA and the vendorID confirms that when tested
the evga card is device 0, the bfg is device 1
the vendor ID does not match, not sure what, GPU-Z shows them to be the same
vendorID for the evga card is 4318, bfg card is 1506, so will I need to maintain a table of devices?
both cards are GTX 260 216 core 896 MB VRAM, only difference is the clock speed
el code:
std::string getGPUstring(HWND hWnd) { // DirectX 9c, XP SP3 or better
UNREFERENCED_PARAMETER(hWnd);
DWORD vendorID, deviceID = 0;
HRESULT hr = S_OK;
UINT i = 0;
std::stringstream ss;
std::string temp = "";
//std::vector <IDXGIAdapter*> vAdapters;
std::vector<GPU> gpu;
GPU g;
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
D3DDISPLAYMODE displayMode;
D3DFORMAT format = D3DFMT_X8R8G8B8;
IDirect3D9* direct3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if (direct3D9 == nullptr) {DX::ThrowIfFailed(E_UNEXPECTED, __FILE__, __LINE__);}
IDirect3D9* direct3D9c = Direct3DCreate9(DIRECT3D_VERSION);
if (direct3D9c == nullptr) {DX::ThrowIfFailed(E_UNEXPECTED, __FILE__, __LINE__);}
hr = direct3D9->GetAdapterIdentifier(0, 0, &adapterIdentifier);
if (S_OK == hr) {
g.desc = adapterIdentifier.Description;
g.deviceID = adapterIdentifier.DeviceId;
g.vendorID = adapterIdentifier.VendorId;
gpu.push_back(g); // insert into the table
}
temp = g.desc;
do {
hr = direct3D9c->EnumAdapterModes(i++, format, 0, &displayMode);
} while (hr == D3D_OK || hr == D3DERR_NOTAVAILABLE);
if (hr != D3DERR_INVALIDCALL) {
DX::ThrowIfFailed(hr, __FILE__, __LINE__);
}
// to do: add device checks to be sure this a a real SLI and not dual cards
if (i > 1) { // SLI or CFX
hr = direct3D9->GetAdapterIdentifier(1, 0, &adapterIdentifier);
if (S_OK == hr) {
g.desc = adapterIdentifier.Description;
g.deviceID = adapterIdentifier.DeviceId;
g.vendorID = adapterIdentifier.VendorId;
gpu.push_back(g); // insert into the table
}
if (gpu[0].vendorID == gpu[1].vendorID) temp += " SLI"; else temp += " CFX";
}
// NVIDIA is 0x10DE, supposed to be anyway;
ss << " " << gpu[0].vendorID << " " << gpu[1].vendorID << " " << gpu[0].deviceID << " " << gpu[1].deviceID << " " << std::endl;
temp += ss.str();
direct3D9->Release();
direct3D9c->Release();
return temp;
}
Corsair Carbide 300R with window & Corsair TX850V2 70A@12V
Asus M5A99FX PRO R2.0 CFX/SLI & AMD Phenom II 965 C3 Black Edition @ 4.0 GHz & G.SKILL RipjawsX DDR3-2133 8 GB
GTX 260 SLI 216 core (GT200 Tesla) & Asus PA238QR IPS LED HDMI DP 1080p
ST2000DM001 & Windows 7 x64 Enterprise
Microsoft Wireless Desktop 2000 & Wacom Bamboo CHT470M
Place your rig specifics into your signature like I have, makes it 100x easier to understand!
Hardcore Games, Legendary is the Only Way to Play
Continue reading...
I have 1 EVGA and 1 BFG card, both are NVIDIA and the vendorID confirms that when tested
the evga card is device 0, the bfg is device 1
the vendor ID does not match, not sure what, GPU-Z shows them to be the same
vendorID for the evga card is 4318, bfg card is 1506, so will I need to maintain a table of devices?
both cards are GTX 260 216 core 896 MB VRAM, only difference is the clock speed
el code:
std::string getGPUstring(HWND hWnd) { // DirectX 9c, XP SP3 or better
UNREFERENCED_PARAMETER(hWnd);
DWORD vendorID, deviceID = 0;
HRESULT hr = S_OK;
UINT i = 0;
std::stringstream ss;
std::string temp = "";
//std::vector <IDXGIAdapter*> vAdapters;
std::vector<GPU> gpu;
GPU g;
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
D3DDISPLAYMODE displayMode;
D3DFORMAT format = D3DFMT_X8R8G8B8;
IDirect3D9* direct3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if (direct3D9 == nullptr) {DX::ThrowIfFailed(E_UNEXPECTED, __FILE__, __LINE__);}
IDirect3D9* direct3D9c = Direct3DCreate9(DIRECT3D_VERSION);
if (direct3D9c == nullptr) {DX::ThrowIfFailed(E_UNEXPECTED, __FILE__, __LINE__);}
hr = direct3D9->GetAdapterIdentifier(0, 0, &adapterIdentifier);
if (S_OK == hr) {
g.desc = adapterIdentifier.Description;
g.deviceID = adapterIdentifier.DeviceId;
g.vendorID = adapterIdentifier.VendorId;
gpu.push_back(g); // insert into the table
}
temp = g.desc;
do {
hr = direct3D9c->EnumAdapterModes(i++, format, 0, &displayMode);
} while (hr == D3D_OK || hr == D3DERR_NOTAVAILABLE);
if (hr != D3DERR_INVALIDCALL) {
DX::ThrowIfFailed(hr, __FILE__, __LINE__);
}
// to do: add device checks to be sure this a a real SLI and not dual cards
if (i > 1) { // SLI or CFX
hr = direct3D9->GetAdapterIdentifier(1, 0, &adapterIdentifier);
if (S_OK == hr) {
g.desc = adapterIdentifier.Description;
g.deviceID = adapterIdentifier.DeviceId;
g.vendorID = adapterIdentifier.VendorId;
gpu.push_back(g); // insert into the table
}
if (gpu[0].vendorID == gpu[1].vendorID) temp += " SLI"; else temp += " CFX";
}
// NVIDIA is 0x10DE, supposed to be anyway;
ss << " " << gpu[0].vendorID << " " << gpu[1].vendorID << " " << gpu[0].deviceID << " " << gpu[1].deviceID << " " << std::endl;
temp += ss.str();
direct3D9->Release();
direct3D9c->Release();
return temp;
}
Corsair Carbide 300R with window & Corsair TX850V2 70A@12V
Asus M5A99FX PRO R2.0 CFX/SLI & AMD Phenom II 965 C3 Black Edition @ 4.0 GHz & G.SKILL RipjawsX DDR3-2133 8 GB
GTX 260 SLI 216 core (GT200 Tesla) & Asus PA238QR IPS LED HDMI DP 1080p
ST2000DM001 & Windows 7 x64 Enterprise
Microsoft Wireless Desktop 2000 & Wacom Bamboo CHT470M
Place your rig specifics into your signature like I have, makes it 100x easier to understand!
Hardcore Games, Legendary is the Only Way to Play
Continue reading...