Sign in to follow this  
schupf

DX9 Lost device

Recommended Posts

Hello!

I am really getting lost about a little warning message in my device lost code.
I only call my render method if getState() returns RS_READY:
[code]
RS_STATE rsState = mRenderSystem->getState();
if(rsState == RS_READY)
renderOneFrame();
[/code]
and this is my getState() method:

[code]
RS_STATE D3D9RenderSystem::getState() {
HRESULT hr = mDevice->TestCooperativeLevel();

if(FAILED(hr)) {
WindowUtilities::messagePump(); // Keep message loop running
if(hr == D3DERR_DEVICELOST) {
OutputDebugString("Device Lost!\n");
mRoot->getTimer()->pause();
return RS_NOT_READY;
}
if(hr == D3DERR_DEVICENOTRESET) {
//onLostDevice();
OutputDebugString("Device Not Reset!\n");
D3DPRESENT_PARAMETERS defaultPresentParams(mDefaultPresentParams);
hr = mDevice->Reset(&defaultPresentParams);

if(FAILED(hr))
return RS_NOT_READY;

//onResetDevice();
return RS_READY;
}

}

return RS_READY;
}
[/code]
Nothing special as you can see. Now if I alt+tab from my fullscreen application to windows I periodically get these messages:
[quote]
Device Lost!
Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails
Device Lost!
Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails
Device Lost!
Direct3D9: (WARN) :Window does not have focus. TestCooperativeLevel fails
[/quote]
What causes this warning and how can I fix it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this