- Fixed: IDirect3D9::CreateDevice() can return D3DERR_DEVICELOST if you want exclusive mode and

some other application already has it. While technically this is a failure, the device is
  still created, so we can continue using it anyway.

SVN r2326 (trunk)
This commit is contained in:
Randy Heit 2010-05-14 03:54:35 +00:00
parent 1c8397e86d
commit b2a4ffc718

View file

@ -322,19 +322,23 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
HRESULT hr;
if (FAILED(hr = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
hr != D3DERR_DEVICELOST)
{
if (FAILED(D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
hr != D3DERR_DEVICELOST)
{
if (d3dpp.FullScreen_RefreshRateInHz != 0)
{
d3dpp.FullScreen_RefreshRateInHz = 0;
if (FAILED(hr = D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
hr != D3DERR_DEVICELOST)
{
if (FAILED(D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, Window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)))
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
hr != D3DERR_DEVICELOST)
{
D3DDevice = NULL;
}
@ -360,9 +364,7 @@ D3DFB::D3DFB (int width, int height, bool fullscreen)
{
DeviceCaps.LineCaps |= D3DLINECAPS_ANTIALIAS;
}
// I don't know about ATI's drivers. The only ATI device
// I have readily available to test with (a Mobility X300)
// really doesn't support them.
// ATI's drivers apparently also lie, so screw this cap.
}
CreateResources();
SetInitialState();