Cannot recover lost device
I have fullscreen app using directInput. I tried to handle DEVICELOST event, so i used this code in msg pump:
if((D3DDev->TestCooperativeLevel())!= D3D_OK){
if(D3DDev->TestCooperativeLevel()==D3DERR_DEVICELOST){
DIH.UnAcquire(); //dinput
Sleep(500);
ReleaseSurfaces();//here i release all
//surfaces using POOL memory
}else if(D3DDev->TestCooperativeLevel()==D3DERR_DEVICENOTRESET){
lpD3DDevice->Reset(&pp);
RecoverSurfaces();
}
}else{
/* here i render , update logics and so on because if im here, the device is not lost*/
}
The problem is, that it never enters
if(D3DDev->TestCooperativeLevel()==D3DERR_DEVICENOTRESET)
so the device cannot be reseted. My app remains minimalized and i can only close it.
Any ideas what can be wrong?
Ok, main problem was my stupidity after all, i placed whole code not in msg pump..
But now all is fine, but when i try to reset device, it does not return D3D_OK. What it returns i cannot say, but for sure its not one of codes mentioned in docs: D3DERR_DEVICELOST , D3DERR_DRIVERINTERNALERROR, D3DERR_INVALIDCALL,
D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY.
I do release all vertex buffers and textures using D3DPOOL_DEFAULT memory before attempting to reset device. I have no idea what more should i release.. I use directSound, i have stencil shadows, i also have bumpmapped water made with two render target textures but i release them too. What else should i release?
But now all is fine, but when i try to reset device, it does not return D3D_OK. What it returns i cannot say, but for sure its not one of codes mentioned in docs: D3DERR_DEVICELOST , D3DERR_DRIVERINTERNALERROR, D3DERR_INVALIDCALL,
D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY.
I do release all vertex buffers and textures using D3DPOOL_DEFAULT memory before attempting to reset device. I have no idea what more should i release.. I use directSound, i have stencil shadows, i also have bumpmapped water made with two render target textures but i release them too. What else should i release?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement