CreateDevice() Returns D3DERR_NOTAVAILABLE

Started by
8 comments, last by Evil Steve 20 years, 8 months ago
I'm trying this little D3D9 test app. It runs fine on my GeForce4, on my server with only onboard gfx, and on my dads PC (Win98, TNT2). However, it refuses to run on my mates computer (TNT2, WinXP). When it gets to CreateDevice(), it returns D3DERR_NOTAVAILABLE ("This device does not support the queried technique"). But i don't know what parameter its objecting to. Here's how i set up the presentation params:

ZeroMemory(&m_thePresentParams,sizeof(m_thePresentParams));
m_thePresentParams.BackBufferWidth = m_vModes[m_nSelectedMode].nWidth;
m_thePresentParams.BackBufferHeight = m_vModes[m_nSelectedMode].nHeight;
m_thePresentParams.BackBufferCount = 2;
m_thePresentParams.MultiSampleType = D3DMULTISAMPLE_NONE;
m_thePresentParams.MultiSampleQuality = 0;
m_thePresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_thePresentParams.hDeviceWindow = m_hWnd;
m_thePresentParams.Windowed = TRUE;
m_thePresentParams.BackBufferFormat = D3DFMT_UNKNOWN;
m_thePresentParams.EnableAutoDepthStencil = FALSE;
m_thePresentParams.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
m_thePresentParams.Flags = 0;
m_thePresentParams.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
m_thePresentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
And i create the device like so:

hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,m_hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&m_thePresentParams,&m_pDevice);
And at the call to CreateDevice(), hResult == D3DERR_NOTAVAILABLE. I've made sure my mate has DX9 installed, and has the latest drivers. Anyone know whats going on here? [edited by - Evil Steve on August 19, 2003 11:53:30 AM]
Advertisement
DX9 requires DX7+ drivers. Most probably, the drivers you have are pre DX7 drivers, so DX9 is not available, and you''ll have to use DX8.1- on these devices/drivers.
Are you using the latest drivers?

If is running en WinXP the Drivers are Direct3D 8.x, becose XP got TNT2 Drivers and DX8. But I am not sure if you can use 2 BackBuffers in Windowed Mode.

This is from de MSDN-DirectX Reference

"The method fails if one back buffer cannot be created. The value of BackBufferCount influences what set of swap effects are allowed. Specifically, any D3DSWAPEFFECT_COPY swap effect requires that there be exactly one back buffer."


Sorry for my English.

Coder: I got him to downlaod the latest drivers (released 13th Aug 2003), and If DX9 was unavailiable (as it was when he first etsted my app), it''d say that the file d3d9.dll could not be found.

SergioJdelos: It works on all the other cards, and i have the swap effect set to D3DSWAPEFFECT_DISCARD. Also, it fails in fullscreen mode (same error), so i don''t think thats the problem.

Thanks for the replies,
Steve
Alright, i've found the problem, but not the solution. That code i pasted is wrong (its from a newer version of the test app). My mates card doesn't seem to like having a Z-Buffer.
This works:
m_thePresentParams.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
m_thePresentParams.EnableAutoDepthStencil = FALSE;
But this doesn't:
m_thePresentParams.AutoDepthStencilFormat = D3DFMT_D24S8
m_thePresentParams.EnableAutoDepthStencil = TRUE;
I got him to run the DX Caps viewer, and it says that his card supports D3DFMT_D24S8 for fullscreen and windowed mode.

Anyone know what on earth is going on here???

Cheers,
Steve

[edited by - Evil Steve on August 19, 2003 1:20:38 PM]
The TNT Don´t work with Stencil in 16Bits. Try in 32Bit Mode(Both Modes Fullscreen and Windowed).
That is 32Bit. 24 bits depth, 8 bits stencil.

Edit: CheckDepthStencilMatch(3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,D3DFMT_X8R8G8B8,D3DFMT_X8R8G8B8,D3DFMT_D24S8) Succeeds also.


[edited by - Evil Steve on August 19, 2003 2:08:49 PM]
I mean In TNT, and i belive geforce256 too, you must set 32Bits for Screen to use 32Bits in Depth/Stencil Buffers, that is 32Bits for colors, 24 for Depth Buffer and 8 For stencil(D3DFMT_X8R8G8B8 for Screen,D3DFMT_X8R8G8B8 for BackBuffer and D3DFMT_D24S8 for Depth/Stencil is OK).
If you check if the adapter work in 32Bits will return Succeeds becose the HW Support It, but you must Set the Display Settings to 32Bits(Color and Depth/stencil) to use it. In OpenGL is the same.
If you use 16 desk color in D3D you will not have Stencil and 24Bits Depth Buffer, and in OpenGL will run emulated in software.

If is not that i don´t know.

Again sorry for my english.
Ah, right. Well, its already running in 32-bit (for both fullscreen and windowed). The video setting that it loads are 800x600x32 at the moment.
quote:Original post by Evil Steve
Coder: I got him to downlaod the latest drivers (released 13th Aug 2003), and If DX9 was unavailiable (as it was when he first etsted my app), it''d say that the file d3d9.dll could not be found.

No. If the DX9 runtime''s installed, but the driver doesn''t support d3d9 (i.e. a pre-dx7 driver) the d3d9.dll file will be found, and the d3d9 object will be created, but you''ll get a D3DERR_NOTAVAILABLE error on CreateDevice (tried it myself).

Anyway, I don''t know anything to help you with your problem. Maybe try one of the SDK samples on his PC, and check which DepthStencil format it used?


This topic is closed to new replies.

Advertisement