Am Donnerstag, 14. Februar 2008 04:22:16 schrieb Peter Dons Tychsen:
Why does the SwapChain-destroy function play around with the resolution at all. Is that really necessary? I think it should not do it if the caller is ddraw at least.
I thought I'm filtering this out in the case of ddraw, but maybe that got lost. The reason why the swapchain restores the resolution is the different way ddraw/d3d8 and d3d8/d3d9 set up the screen.
In ddraw the app calls IDirectDraw7::SetDisplayMode. This sets the mode. Then it creates a DDSCAPS_PRIMARYSURFACE surface, which creates the swapchain.
In d3d8/d3d9 the swapchain controls the video mode
I think the problem is that RestoreDisplayMode is called before the primary surface is destroyed. The question is why this happens. I can think of the following reasons:
-> Refcounting problem, or the app just doesn't release the surfaces. Then ddraw.dll destroys the objects on DLL_PROCESS_DETACH
-> The app calls it that way. This needs a test, but I think it is not allowed to call SetDisplayMode / RestoreDisplayMode while a primary surface is around