Click to See Complete Forum and Search --> : DX9 - CreateDevice Fails?


Calculator
October 27th, 2006, 04:40 PM
I am trying to create an adaptor device (I think). I am using the debug libraries, which spit this at me:

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.

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.

Calculator
November 30th, 2006, 03:45 AM
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'

miteshpandey
November 30th, 2006, 04:45 AM
Not sure but does you monitor's color depth support 32-bit.

You might need to change the color depth to 32-bit through the display properties if available.

Calculator
December 1st, 2006, 04:17 PM
Is there any way I can use a different color mode if my monitor does not support it? Is this 32-bit stuff represented by the D3DFMT being X8R8G8B8 (8 bits bor alpha, r, g, and b)?

Mike Harnad
December 1st, 2006, 05:16 PM
3) That I do not fill out all the fields of the D3DPRESENT_PARAMETERS structureMake sure you initialize the structure before using it.

Calculator
December 1st, 2006, 06:17 PM
It is zero initialized.