UPDATE:
Just did a test, the original code:
if(D3D_OK != mD3d->CreateDevice(D3DADAPTER_DEFAULT, mDevType, mHwnd, mVertexProcessing, &mD3dpp, &mD3ddev)) return false;
if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
mD3ddev->SetVertexDeclaration(mVertexDeclaration);
if(!mD3dFont.Create(mD3ddev, "Arial", 16, 10, 95, 200, 95)) return false;
The new code:
if(D3D_OK != mD3d->CreateDevice(D3DADAPTER_DEFAULT, mDevType, mHwnd, mVertexProcessing, &mD3dpp, &mD3ddev)) return false;
if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
mD3ddev->SetVertexDeclaration(mVertexDeclaration);
if(!mD3dFont.Create(mD3ddev, "Arial", 16, 10, 95, 200, 95)) return false;
// assume device = lost here
mVertexDeclaration->Release();
mVertexDeclaration = NULL;
mD3dFont.OnLostDevice();
mD3ddev->Reset(&mD3dpp);
mD3dFont.OnResetDevice();
if(D3D_OK != mD3ddev->CreateVertexDeclaration(dec, &mVertexDeclaration)) return false;
mD3ddev->SetVertexDeclaration(mVertexDeclaration);
What I achieve with this is that I get the same 'Lost' debug error on the device.
The debug info, originally:
Direct3D9: (INFO) :======================= Hal HWVP device selected
Direct3D9: (INFO) :HalDevice Driver Style b
Direct3D9: (ERROR) :Lost due to display uniqueness change
Direct3D9: (INFO) :Using FF to VS converter
Direct3D9: (INFO) :Using FF to PS converter
D3DX: Unicode support: 1
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 7558: FALSE == pDevice->bPresentSubmitted
Direct3D9: (ERROR) :************************************************************
(where the assertion failed is on the line where I do d3ddev->Present() with a DrawText (LPD3DXFONT), after Clear and between Begin/Endscene.
The new code gives the following debug info:
Direct3D9: (INFO) :======================= Hal HWVP device selected
Direct3D9: (INFO) :HalDevice Driver Style b
Direct3D9: (ERROR) :Lost due to display uniqueness change
Direct3D9: (INFO) :Using FF to VS converter
Direct3D9: (INFO) :Using FF to PS converter
D3DX: Unicode support: 1
Direct3D9: (ERROR) :Lost due to display uniqueness change
Direct3D9: (INFO) :Using FF to VS converter
Direct3D9: (INFO) :Using FF to PS converter
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\hid.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\ntmarta.dll', Symbols loaded (source information stripped).
'Crealysm.exe': Loaded 'C:\Windows\SysWOW64\Wldap32.dll', Symbols loaded (source information stripped).
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 14641: FALSE == pDevice->bPresentSubmitted
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :************************************************************
Direct3D9: (ERROR) :ASSERTION FAILED! File s:\gfx_aug09\windows\directx\dxg\inactive\d3d9\d3d\fw\lhddi.c Line 7558: FALSE == pDevice->bPresentSubmitted
Direct3D9: (ERROR) :************************************************************
Any ideas?