On Thu, 2008-02-14 at 09:18 +0100, Stefan Dösinger wrote:
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
OK, i have now eaten enough wine-gums to comprehend this....
I think there is a general problem in swapchain->release. The swapchain should only change the resolution back to the original *if* the current resolution is still the same as the swapchain enforced. If someone else has intervened, it should let it be. This fixes the problem at hand, but would also fix other silly problems. Some could for example have called Release() while the "window" is not even visible (tabbed to desktop for example).
Please review my patch and let med know if it is submittable. If you hate it, i will eat more wine-gums. :-)
/pedro
Am Freitag, 15. Februar 2008 04:00:20 schrieb Peter Dons Tychsen:
I think there is a general problem in swapchain->release. The swapchain should only change the resolution back to the original *if* the current resolution is still the same as the swapchain enforced. If someone else has intervened, it should let it be. This fixes the problem at hand, but would also fix other silly problems. Some could for example have called Release() while the "window" is not even visible (tabbed to desktop for example).
It sounds good and plausible, but I think a test case(preferably d3d8, d3d9 and ddraw) would make it even better.
Please review my patch and let med know if it is submittable. If you hate it, i will eat more wine-gums. :-)
I like them, but they make the teeth and everything in the mouth sticky due to all the sugar :-)