# Why can a certain DirectX mode produce display lag?

I have written two small test games using DirectX 9. One uses

 presentParams.Windowed = false;

 

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE; 

and the other one uses

 presentParams.Windowed = false; // same results with true

 

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; 

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

 Windowed = false + INTERVAL_ONE => LAG 

 Windowed = false + ...IMMEDIATE => no lag 

Not mentioned in the question but tested:

 Windowed = true; + INTERVAL_ONE => no lag, tearing 

 Windowed = true; + ...IMMEDIATE => no lag 

• Isn't the lag caused by the PresentationInterval not being immediate? – Appleshell Aug 24 '13 at 2:31
• Yes, I think so too. But why isn't INTERVAL_ONE not implemented with less lag, if this seems possible? Is knowing a "scan line to wait for" faster then the drivers own code? Is it a common technique or is it problematic? – M4rkus Aug 24 '13 at 2:48
• What happens if you do Windowed = false and PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE? – Nathan Reed Aug 24 '13 at 2:52
• Then it also needs the vsync code, which tears unless it's tweaked correctly for the graphics card. – M4rkus Aug 24 '13 at 3:28
• How are you building all your other presentation parameters? – Panda Pajama Aug 24 '13 at 15:27