Thread: DX - CreateDevice - D3DERR_INVALIDCALL

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465

    DX - CreateDevice - D3DERR_INVALIDCALL

    I am trying to create an adaptor device (I think). I am using the debug libraries, which spit this at me:

    Code:
    Direct3D9: (ERROR) :Device cannot perform hardware processing. ValidateCreateDevice failed.
    
    D3D9 Helper: IDirect3D9::CreateDevice failed: D3DERR_INVALIDCALL
    Test 2
    Direct3D9: (ERROR) :    [0] : Address 00D0D4CB
    Direct3D9: (ERROR) :    [1] : Address 00D0D59B
    Direct3D9: (ERROR) :    [2] : Address 00D0D440
    Direct3D9: (ERROR) :    [3] : Address 00D01D44
    Direct3D9: (ERROR) :    [4] : Address 00401605
    Direct3D9: (ERROR) :    [5] : Address 004022EE
    Direct3D9: (ERROR) :    [6] : Address 7C816FD7
    Direct3D9: (ERROR) :    [7] : Address 00000000
    Direct3D9: (ERROR) :    [8] : Address 00000000
    Direct3D9: (ERROR) :    [9] : Address 00000000
    Direct3D9: (ERROR) :    [10] : Address 00000000
    Direct3D9: (ERROR) :    [11] : Address 00000000
    Direct3D9: (ERROR) :    [12] : Address 00000000
    Direct3D9: (ERROR) :    [13] : Address 00000000
    Direct3D9: (ERROR) :    [14] : Address 00000000
    Direct3D9: (ERROR) :    [15] : Address 00000000
    Direct3D9: (ERROR) :    [0] : Address 00D04064
    Direct3D9: (ERROR) :    [1] : Address 00D04E4F
    Direct3D9: (ERROR) :    [2] : Address 00D05588
    Direct3D9: (ERROR) :    [3] : Address 00D01D65
    Direct3D9: (ERROR) :    [4] : Address 00401605
    Direct3D9: (ERROR) :    [5] : Address 004022EE
    Direct3D9: (ERROR) :    [6] : Address 7C816FD7
    Direct3D9: (ERROR) :    [7] : Address 00000000
    Direct3D9: (ERROR) :    [8] : Address 00000000
    Direct3D9: (ERROR) :    [9] : Address 00000000
    Direct3D9: (ERROR) :    [10] : Address 00000000
    Direct3D9: (ERROR) :    [11] : Address 00000000
    Direct3D9: (ERROR) :    [12] : Address 00000000
    Direct3D9: (ERROR) :    [13] : Address 00000000
    Direct3D9: (ERROR) :    [14] : Address 00000000
    Direct3D9: (ERROR) :    [15] : Address 00000000
    Direct3D9: (ERROR) :    [0] : Address 00D0572F
    Direct3D9: (ERROR) :    [1] : Address 00D01D65
    Direct3D9: (ERROR) :    [2] : Address 00401605
    Direct3D9: (ERROR) :    [3] : Address 004022EE
    Direct3D9: (ERROR) :    [4] : Address 7C816FD7
    Direct3D9: (ERROR) :    [5] : Address 00000000
    Direct3D9: (ERROR) :    [6] : Address 00000000
    Direct3D9: (ERROR) :    [7] : Address 00000000
    Direct3D9: (ERROR) :    [8] : Address 00000000
    Direct3D9: (ERROR) :    [9] : Address 00000000
    Direct3D9: (ERROR) :    [10] : Address 00000000
    Direct3D9: (ERROR) :    [11] : Address 00000000
    Direct3D9: (ERROR) :    [12] : Address 00000000
    Direct3D9: (ERROR) :    [13] : Address 00000000
    Direct3D9: (ERROR) :    [14] : Address 00000000
    Direct3D9: (ERROR) :    [15] : Address 00000000
    Direct3D9: (ERROR) :    [0] : Address 00D0D4CB
    Direct3D9: (ERROR) :    [1] : Address 00D0D59B
    Direct3D9: (ERROR) :    [2] : Address 00D0D440
    Direct3D9: (ERROR) :    [3] : Address 00D7C2D5
    Direct3D9: (ERROR) :    [4] : Address 00D7A696
    Direct3D9: (ERROR) :    [5] : Address 00D01DBE
    Direct3D9: (ERROR) :    [6] : Address 00401605
    Direct3D9: (ERROR) :    [7] : Address 004022EE
    Direct3D9: (ERROR) :    [8] : Address 7C816FD7
    Direct3D9: (ERROR) :    [9] : Address 00000000
    Direct3D9: (ERROR) :    [10] : Address 00000000
    Direct3D9: (ERROR) :    [11] : Address 00000000
    Direct3D9: (ERROR) :    [12] : Address 00000000
    Direct3D9: (ERROR) :    [13] : Address 00000000
    Direct3D9: (ERROR) :    [14] : Address 00000000
    Direct3D9: (ERROR) :    [15] : Address 00000000
    I try to find a valid device using this code.

    Code:
    	D3DDISPLAYMODE d3ddm = { 0 };
    	bool bDesired = false;
    
    	int nModes = mpd3dInterface->GetAdapterModeCount( D3DADAPTER_DEFAULT, 
    		D3DFMT_X8R8G8B8 );
    
    	for( int i = 0; i < nModes; ++i )
    	{
    		if( FAILED( mpd3dInterface->EnumAdapterModes
    			( D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &d3ddm ) ) )
    		{
    			return 0;
    		}
    
    		if( d3ddm.Width != mnWidth || d3ddm.Height != mnHeight ) continue;
    		if( d3ddm.Format != D3DFMT_X8R8G8B8 ) continue;
    		if( d3ddm.RefreshRate != 75 ) continue;
    
    		bDesired = true;
    		break;
    	}
    
    	if( !bDesired )
    	{
    		return 0;
    	}
    
    	if( FAILED( mpd3dInterface->CheckDeviceType
    		( D3DADAPTER_DEFAULT,
    		D3DDEVTYPE_HAL,
    		D3DFMT_X8R8G8B8,
    		D3DFMT_X8R8G8B8,
    		FALSE ) ) )
    	{
    		return 0;
    	}
    
    	if( FAILED( mpd3dInterface->CheckDeviceFormat
    		( D3DADAPTER_DEFAULT,
    		D3DDEVTYPE_HAL,
    		D3DFMT_X8R8G8B8,
    		D3DUSAGE_DEPTHSTENCIL,
    		D3DRTYPE_SURFACE,
    		D3DFMT_D16 ) ) )
    	{
    		return 0;
    	}
    
    	D3DCAPS9 d3dcaps;
    	ZeroMemory(&d3dcaps, sizeof d3dcaps);
    
    	if( FAILED( mpd3dInterface->GetDeviceCaps
    		( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, 
    		&d3dcaps ) ) )
    	{
    		return 0;
    	}
    
    	DWORD dwBehaviorFlags = 0;
    
    	if( d3dcaps.VertexProcessingCaps != 0 )
    		dwBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
    	else
    		dwBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
    
    
    
    	md3dpp.Windowed               = FALSE;
    	md3dpp.EnableAutoDepthStencil = TRUE;
    	md3dpp.AutoDepthStencilFormat = D3DFMT_D16;
    	md3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
    	md3dpp.BackBufferWidth        = mnWidth;
    	md3dpp.BackBufferHeight       = mnHeight;
    	md3dpp.BackBufferFormat       = D3DFMT_X8R8G8B8;
    
    	if( FAILED( mpd3dInterface->CreateDevice
    		( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, 
    		mhWnd, dwBehaviorFlags, &md3dpp, 
    		&mpd3dDevice ) ) )
    	{
    		return 0;
    	}
    I don't know much about hardware compatibility, but it just seems to not be working getting a 640x480 'device' wven though the enumeration found it.
    Last edited by Tonto; 10-27-2006 at 02:40 PM.

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    It is interesting to note that:

    1) This code works on an XP pro machine with a giant flatscreen than can support all sorts of devices I would guess
    2) This code does not work on an XP home machine with some sort of CRT monitor with a max of resolution of 1024 x 768
    3) That I do not fill out all the fields of the D3DPRESENT_PARAMETERS structure
    4) That I would like to get this to work
    5) That I don't know much about 'hardware compatibility'

  3. #3
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Could it have anything to do with the device I find not supporting a 32-bit color depth? Is there any way I can work around that?

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Set the format to D3DFMT_UNKNOWN and try it or set it to a lower color depth.

    Create normally fails when one of the following occurs:

    • Invalid depth buffer format
    • Invalid color depth
    • Invalid resolution
    • Invalid refresh rate
    • Invalid back buffer format
    • Invalid multi sample
    • Invalid vertex processing
    • Invalid window handle
    • Invalid back buffer format for windowed mode
    • Invalid refresh for windowed mode (must be 0)
    • Device does not support D3D.


    I would say from the error message your video card does not support hardware transformation of vertices. Set this to software and it probably will work. And after that go buy a new video card b/c if it does not support hardware T&L it is ancient.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DX or OpenGL?
    By michaelp in forum Game Programming
    Replies: 31
    Last Post: 01-10-2008, 06:26 PM
  2. Checking for DX in setup and deployment in MSVS 05 .NET
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-15-2006, 03:32 PM
  3. Assembly Tutorials
    By JoshR in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-11-2005, 09:56 AM
  4. Having some trouble setting up Dev-c++ for DX
    By Iamien in forum Game Programming
    Replies: 7
    Last Post: 08-25-2003, 07:30 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM