// New code for PerfHud Support
UINT AdapterToUse = D3DADAPTER_DEFAULT;
D3DDEVTYPE DevType = deviceType;
// look for 'Nvidia PerfHUD Adapter'
// If it's present, override default settings
for(UINT Adapter=0 ; AdapterGetAdapterCount(); Adapter++)
{
D3DADAPTER_IDENTIFIER9 Identifier;
HRESULT hr;
hr = d3d9->GetAdapterIdentifier( Adapter, 0, &Identifier );
if( strstr(Identifier.Description, "PerfHUD") !=0 )
{
AdapterToUse = Adapter;
DevType = D3DDEVTYPE_REF;
break;
}
}
// now to create the device
if(FAILED(d3d9->CreateDevice
(
AdapterToUse, // choose primary VGA adapter
DevType, // set the device type to HAL
hwnd,
vp, // set the hardware vertex process
&d3dpp, // supply the present paramters
device
)))
{
::MessageBox(0,"Device Creation Failed",0,0);
return false;
}