V
Vegan Fanatic
Guest
For some reason when I call this using a constant 0 for the adapter number this works fine
using the variable i seems to be a problem, when more than one adapter is installed
std::string getGPUstring(HWND hWnd) { // DirectX 9c, XP SP3 or better
UNREFERENCED_PARAMETER(hWnd);
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__);}
// Start with how many video cards are installed
do {
hr = direct3D9c->EnumAdapterModes(i++, format, 0, &displayMode);
} while (hr == D3D_OK || hr == D3DERR_NOTAVAILABLE);
if (hr != D3DERR_INVALIDCALL) {DX::ThrowIfFailed(hr, __FILE__, __LINE__);}
for (int j=0; j<(int)i; j++) {
hr = direct3D9->GetAdapterIdentifier(i, 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;
if (i > 1) { // SLI or CFX
// NVIDIA is 0x10DE, most of the time, otherwise assume AMD for now
if (gpu[0].vendorID == 0x10DE) temp += " SLI"; else temp += " CFX";
}
direct3D9->Release();
direct3D9c->Release();
return temp;
}
I am now increasingly worried there is a problem with the manual or the DX functions
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...
using the variable i seems to be a problem, when more than one adapter is installed
std::string getGPUstring(HWND hWnd) { // DirectX 9c, XP SP3 or better
UNREFERENCED_PARAMETER(hWnd);
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__);}
// Start with how many video cards are installed
do {
hr = direct3D9c->EnumAdapterModes(i++, format, 0, &displayMode);
} while (hr == D3D_OK || hr == D3DERR_NOTAVAILABLE);
if (hr != D3DERR_INVALIDCALL) {DX::ThrowIfFailed(hr, __FILE__, __LINE__);}
for (int j=0; j<(int)i; j++) {
hr = direct3D9->GetAdapterIdentifier(i, 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;
if (i > 1) { // SLI or CFX
// NVIDIA is 0x10DE, most of the time, otherwise assume AMD for now
if (gpu[0].vendorID == 0x10DE) temp += " SLI"; else temp += " CFX";
}
direct3D9->Release();
direct3D9c->Release();
return temp;
}
I am now increasingly worried there is a problem with the manual or the DX functions
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...