Jump to content
  • Advertisement
Sign in to follow this  
PedroMachin

GetAdapterCount() always returns 0

This topic is 2604 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[color="#1C2837"]Hello! I'm using the June 2010 release of DirectX on Visual Studio C++ 2010.

[color="#1C2837"]
After spending the whole day trying to make the project link (essentially ran into this problem [color="#1C2837"](http://www.gamedev.n...les-with-dx90c/)[color="#1C2837"]) now the project compiles, but I just get a black screen. I tracked down the problem to the GetAdapterCount() always returning zero and therefore not building a device list. I looked this up online, but I only found some reference to the OS sometimes being at fault in some systems?! Any ideas of where to go from here?
[color="#1C2837"]

HRESULT D3DApplication::BuildDeviceList()
{
const DWORD dwNumDeviceTypes = 2;
const TCHAR* strDeviceDescs[] = { _T("HAL"), _T("REF") };
const D3DDEVTYPE DeviceTypes[] = { D3DDEVTYPE_HAL, D3DDEVTYPE_REF };

BOOL bHALExists = FALSE;
//BOOL bHALIsWindowedCompatible = FALSE;
BOOL bHALIsDesktopCompatible = FALSE;
BOOL bHALIsSampleCompatible = FALSE;

/* debug code
UINT adapterCount = m_pD3D->GetAdapterCount();
if(adapterCount == 0)
{
return 0; <<<<<-------always exits here
}else if(adapterCount == 1)
{
return 1;
}*/

// Loop through all the adapters on the system (usually, there's just one
// unless more than one graphics card is present).
for( UINT iAdapter = 0; iAdapter < m_pD3D->GetAdapterCount(); iAdapter++ )
{
// Fill in adapter info

.........

Share this post


Link to post
Share on other sites
Advertisement

Is your DirectX interface initiated before you are trying to GetAdapterCount() ??


Yes, the interface is initiated. It only FAILED BuildDeviceList() (which called GetAdapterCount() unsuccessfully):


HRESULT D3DApplication::InitializeDirect3D()
{
HRESULT hr;

m_hWnd = GetAppWindow();

// Create the Direct3D object
m_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
if( m_pD3D == NULL )
return DisplayErrorMsg( D3DAPPERR_NODIRECT3D, MSGERR_APPMUSTEXIT );

if( FAILED( hr = BuildDeviceList() ) )
{
SAFE_RELEASE( m_pD3D );
return DisplayErrorMsg( hr, MSGERR_APPMUSTEXIT );
}

..........

Share this post


Link to post
Share on other sites
[s]This is really just a guess, but you may need to CreateDevice() before you check GetAdapterCount()[/s]

edit: i looked into it and this information is wrong, sorry about that.

Share this post


Link to post
Share on other sites
Try making a test application outside of your class that inits d3d then calls GetAdapterCount() see if it still returns zero, it might be a bug with your driver or video card.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!