We have an application, that render and present some output. It have to work in window mode and it have to produce stable 60 fps minimum.
One version of application is using Direct3D 9 and another Direct3D 10. When we are working in window mode, sometimes we have fps decrease (it's not "stable" decrease. For most of time we are producing stable 60 fps, sometimes it suddenly decrease for several seconds and then getting back to 60 fps). On both version of application fps decrease is ~10-20 fps. It's unacceptable.
In Windows Vista and Windows 7 there are new graphic system, called "desktop composition", that changed the way applications display pixels on the screen. Desktop composition is performed by the Desktop Window Manager (DWM). You know, when DWM is enabled, applications draw into off-screen surfaces in video memory, than it rendered by DWM and presented onto display in some time. So, we noticed, when dwm.exe in Task manager don't do anything (have ~0% process time), we have fps decrease and when dwm.exe takes 1-3% process time there are stable 60 fps and all is ok.
We can't influence on it. So, we have to turn DWM off in order to have high stable fps. When we turn it off, all is ok. There are stable 60 fps on both versions of application. But DWM do the vsync in window mode, so when we turn it off, we have to do vsync by ourselves.
But when we turn DWM off, there is a problem with vsync in Direct3D 10 in window mode. There are image tearing in top of a monitor. Direc3D 9 keeps working well.
So, we have a monitor with 60 Hz refresh rate.
While creating swapchain, we set such params:
swapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
And while presenting we set a flag to turn vsync on:
m_pSwapChain->Present( 1, 0 );
And have the next vsync problem. There are vertical lines, that are moving fast from left side to right. And there is image tearing in the top of a monitor.
At first we think, that we are doing something wrong. So I installed Microsoft's sample "Tutorial 07: Texture Mapping and Constant Buffers" with rotating cube. Made cube bigger, placed it higher, made it to rotate faster and got the same problem (see pictures).
So, on Direct3D 10 in fullscreen mode all is ok. Vsync works perfectly. On Direct3D 9 it's all ok too, with DWM disabled or enabled, vsync works good. On Direct3D 10 in window mode with DWM disabled there are problems.
It was tested on different computers, different videocards (Nvidia 8600 GT, Nvidia 9500 GT, ATI Radeon HD 5870 Eyefinity 6) and different versions of drivers. Problem stably reproduced. We are using Windows 7.
So, why there is such problem? How to solve it and what to do next?
UPD1. If images above are unavailable, there are some mirrors.
UDP2. I want also to notice, that I'm creating window with the flag WS_POPUP in order to hide title bar (it has to be hidden). Image tearing appears in different places. It's always in the top of a screen, but it can be on 20 px, and can be on 50 px. So, while creating window with title bar, image tearing sometimes can be simply not visible with the top part of image.
Edited by nicolausYes, 14 November 2012 - 04:57 AM.