Last Updated:
10
/
01
/
2008
Device IDs allow your application to determine what NVIDIA processor is
in the system. The sample code listed below
illustrates how the process works. NVIDIA's vendor ID is 0x10DE
In the past, developers often queried a GPU’s device ID (through Windows) to
find out what GPU they were running on. The device IDs have historically
been monotonically increasing. However, with the GeForce 6 & 7 Series GPUs,
this is no longer the case. Therefore, we recommend that you rely on caps
bits (in DirectX) or the extensions string (in OpenGL) to establish the
features of the GPU you’re running on. If you’re using OpenGL’s renderer
string, don’t forget that NV40-based chips do not all have an “FX” moniker
in their name (they are named “GeForce 6xxx” or “Quadro FX x400”).
Similarly, G70-based chips are named “GeForce 7xxx”.
Device IDs are often used by developers to try to reduce support calls. If
you mishandle Device IDs, you will instead create support calls.
Often, when we create a new GPU, many applications will not recognize it
and fail to run.
One key idea that cannot be stressed enough is that not recognizing a
Device ID does not give you any information. Do not take any drastic
action just because you do not recognize a Device ID.
The only reasonable use of Device ID is to take action when you
recognize the ID, and you know there is a special capability or
issue you wish to address.
Some games are failing to run on GeForce 6 & 7 Series GPUs because they
mis-identify the GPU as a TNT-class GPU, or don’t recognize the Device ID.
This behavior creates a support nightmare, as the NV4X and G70 generation
of chips is the most capable ever, and yet some games won’t run due to poor
coding practices.
Device IDs are also not a substitute for caps and extension strings.
Caps have and do change over time, due to various reasons. Mostly, caps
will be turned on over time, but caps also get turned off, due to specs
being tightened up and clarified, or simply the difficulty or cost of
maintaining certain driver or hardware capabilities.
Render target and texture formats also have been turned off from time to
time, so be sure to check for support.
// Example code to retrieve vendor and device ID's for the primary display
// device.
//
// NOTE: Visual Studio 6 does not ship with a winuser.h that defines the
// EnumDisplayDevices function so in order to compile this code, you'll
// need to install the Platform SDK.
#include <windows.h>
#include <string>
#include <iostream>
using namespace std;
bool GetDeviceIdentification(string &vendorID, string &deviceID)
{
DISPLAY_DEVICE dd;
dd.cb = sizeof(DISPLAY_DEVICE);
int i = 0;
string id;
// locate primary display device
while (EnumDisplayDevices(NULL, i, &dd, 0))
{
if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
{
id = dd.DeviceID;
break;
}
i++;
}
if (id == "") return false;
// get vendor ID
vendorID = id.substr(8, 4);
// get device ID
deviceID = id.substr(17, 4);
return true;
}
int main(void)
{
string vendorID;
string deviceID;
if (GetDeviceIdentification(vendorID, deviceID))
{
cout << "Vendor ID: " << vendorID << endl;
cout << "Device ID: " << deviceID << endl;
}
else
cout << "Unable to locate device information" << endl;
return 0;
}