Saturday, December 20, 2008

The joys of device loss

So far so good with handling it; I lost an awful lot of time of trying to figure why my call to Device->Reset wasn't working until I went back to the SDK documentation and realised that I had some state blocks lying around that I wasn't releasing before (and recreating after). I don't need to release/recreate anything else as I had thought ahead and put it all in managed memory from the outset.

Now at least an Alt-Tab back event will restore the main window properly without crashing, but textures seem to get a bit messed up. The alpha channels are OK, but the RGB channels all go to black. (UPDATE - all OK, I just had some missing state on my texture stages).

If this seems like an awful lot of work for something that could be handled easily by just creating a frameless window, setting Windowed to TRUE in the present parameters always, and relying on good old ChangeDisplaySettings instead of letting Direct3D handle mode changes, well it is. But a fullscreen Direct3D device is almost twice as fast as a windowed one at the same resolution, so it's well worth the extra effort.

0 comments: