问题描述
dx9设备有初始化代码
D3DDISPLAYMODE显示;
m_pD3D-> GetAdapterDisplayMode(D3DADAPTER_DEFAULT,& display);
ZeroMemory(& m_d3dpp,sizeof(m_d3dpp));
m_d3dpp.Windowed = false;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dpp.BackBufferFormat = display.Format;
m_d3dpp.EnableAutoDepthStencil = false;
m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
/ * BackBufferHeight和BackBufferWidth也从其他位置设置* /
DWORD标志= D3DCREATE_FPU_PRESERVE | D3DCREATE_MULTITHREADED;
m_pD3D-> CreateDevice(D3DADAPTER_DEFAULT,m_Devtype,hWnd,标志,& m_d3dpp,& m_pd3dDevice)
事实是,这对m_Devtype = D3DDEVTYPE_HAL和m_Devtype = D3DDEVTYPE_REF都适用。
但是在某些特定计算机(winXP,sp3,最后安装的dx)上)CreateDevice对于D3DDEVTYPE_HAL返回D3DERR_INVALIDCALL,对于D3DDEVTYPE_REF返回D3DERR_NOTAVAILABLE。 m_pD3D
和 display
均有效。 display
结构的格式字段中包含rgb565。
似乎很重要: DX Caps Viewer未显示任何硬件适配器
看起来每个参数在CreateDevice中都正确,我希望它必须为引用设备返回D3D_OK,为什么不呢?
>UPD1:现在我知道,这种不幸的XP在某些虚拟机上运行。我猜这就是为什么只有一个软件适配器的原因。
您没有在CreateDevice函数中指定任何顶点处理方法。尝试将其设置为D3DCREATE_SOFTWARE_VERTEXPROCESSING,则必须设置一种顶点处理方法,这是DirectX SDK文档中的必填项。 ,
和D3DCREATE_SOFTWARE_VERTEXPROCESSING是互斥标志。
在
调用CreateDevice时,必须至少指定这些顶点处理标志之一。
There is initializing code for dx9 device
D3DDISPLAYMODE display;
m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &display);
ZeroMemory(&m_d3dpp, sizeof(m_d3dpp));
m_d3dpp.Windowed = false;
m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_d3dpp.BackBufferFormat = display.Format;
m_d3dpp.EnableAutoDepthStencil = false;
m_d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
/*BackBufferHeight and BackBufferWidth also set from elsewhere*/
DWORD flags = D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED;
m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, m_Devtype, hWnd, flags, &m_d3dpp, &m_pd3dDevice)
The fact is that this works well with both m_Devtype = D3DDEVTYPE_HAL and m_Devtype = D3DDEVTYPE_REF.
But on some particular computer (winXP, sp3, last dx installed) CreateDevice returns D3DERR_INVALIDCALL for D3DDEVTYPE_HAL and D3DERR_NOTAVAILABLE for D3DDEVTYPE_REF. m_pD3D
and display
are both valid. display
struct has rgb565 in format field.
Seems to be important: "DX Caps Viewer" shows no hardware adapters and only one software, with format rgb565.
Looks like every parameter is right in CreateDevice and i expect that it must return D3D_OK for reference device, why not?
UPD1: Now i know, that this unlucky XP runs on some virtual machine. That's why there is just one software adapter, i guess.
You didn't specify any vertex processing method in CreateDevice function. try set it as D3DCREATE_SOFTWARE_VERTEXPROCESSING, you must set one of the vertex process method, this is mandatory accroding to DirectX SDK document.
这篇关于DirectX9 CreateDevice失败,出现D3DERR_NOTAVAILABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!