Finally I'm getting around to responding to lost devices in Direct3D in my core engine code. It's actually not as tough or complex as I once thought.
However it is not working correctly yet. Here is what I'm doing:
- Testing return value of TestCooperativeLevel() at start of render
- If return is D3D_OK, proceed to update and render
- If return is D3DERR_DEVICELOST do nothing but return to caller
- If return is D3DERR_DEVICENOTRESET, invalidate device objects for CD3DFont, Reset() the device, Call InitD3D() to re-initialize device with stored D3DPRESENT_PARAMETERS (class data member), and return.
The Reset() is not working completely. When I Alt-Tab out of the game and then back in, it works but only the font is showing. I can clear the back buffer to any color I want, but no primitives or textures are visible.
Any ideas as to why this might be?