I just fixed the alt-tabbing crash when downsampling.
This was the result of a bit more than 3 hours of heavy debugging today, after doing the same already (unsuccessfully) a few times previously over the week.
Basically, the issue has always been that my calls to
device->Reset() returned a
D3DERR_NOTAVAILABLE error code. According to the documentation that’s not even possible, but here we are.
My error when debugging this was assuming that similar issues as for “normal” programs could apply. So I spent most of my time trying to hunt down a resource/memory leak – the usual cause for failing calls to
Reset(). I should have known that I am not someone who just leaks memory willy-nilly ;). By the way, Microsoft’s PIX works really well for memory leak debugging DirectX9 applications.
The actual cause was much more obscure, and directly related to what a rather insane piece of software GeDoSaTo is in the first place. Basically, while downsampling, GeDoSaTo manipulates the results of umpteen Windows API calls to give an application the illusion – as perfectly as possible – that it is running on a display featuring the downsampling resolution. As it turns out, when DirectX performs a
Reset operation, it checks whether its resolution switching succeeded using one of these APIs. So, after many hours over weeks of debugging, the solution to the crash is simply to turn off all the relevant interception mechanisms while the
Reset() call is happening.