Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

serious bug in IDXGISwapChain1::Present1()

$
0
0

Depending on the situation, the "SyncInterval" parameter in the Present1() call has a different meaning:

https://msdn.microsoft.com/en-us/library/windows/desktop/hh446797%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

a) bitblt model: "Synchronize presentation for at least n vertical blanks".
b) Flip model: "Synchronize presentation after the nth vertical blank".

This difference alone would be annoying but not a big problem, if it were clearly defined in which situation which interpretation were used. Unfortunately in real life DXGI switches between different interpretations in unexpected ways.

Practically, in Windows 8.1 x64, I experience the following:


1) In simple windowed mode, when using the flip model, as long as my rendering window is only covering a part of the screen, everything behaves as expected. SyncInterval is interpreted as b).

2) If I switch this flip model swap chain into fullscreen exclusive mode, suddenly the SyncInterval is interpreted as a), even though I haven't changed the model (still flip). However, if I try to create a swap chain directly in fullscreen exclusive mode with the flip model, DXGI reports an error. So it seems that in fullscreen exclusive mode the flip model is not supported. So my best guess is that if I switch a flip model swap chain into fullscreen exclusive mode, it silently changes to DISCARD. Which is somewhat unexepcted, but ok.

3) Here comes the *real* problem: If my flip model rendering window covers the whole screen (including the taskbar), the SyncInterval is suddenly interpreted as a). If I right click on the rendering window to open a context menu, SyncInterval is interpreted as b). If the context menu disappears, SyncInterval is interpreted as a). If I open a settings window which covers part of the rendering window, SyncInterval is interpreted as b). If I close that settings window, SyncInterval is interpreted as a). So basically, based on the size and position of the rendering window, and based on whether there's any other window covering the rendering window or not, DXGI switches back and forth between different SyncInterval interpretations all the time, without giving me any notice about it. Please note that we're *not* talking about fullscreen exclusive mode here. I know for a fact that I'm still in windowed mode all the time. How am I supposed to calculate proper SyncInterval values if DXGI changes the meaning of this parameter all the time behind my back??

I'm aware of that 99.9% of all applications never use any SyncInterval value other than 0 or 1. And with those values there's no difference. But I want to use values higher than 1 in some situations. And then suddenly this DXGI behaviour becomes a major problem.

(P.S: You may wonder why I want to use values higher than 1. The reason is that I'm writing a video renderer, which wants to render and present several frames in advance. Now if I render a 24fps movie on a 60Hz screen, I can only present several frames in advance by either presenting the same frame multiple times to cover each VSync. Or by using a SyncInterval value bigger than 1. The latter saves GPU performance, so that's why I want to use it.)

(P.P.S: You may wonder how I know which SyncInterval interpretation is active at any given time: Easy, by analyzing the "IDXGISwapChain::GetFrameStatistics()" information).


Viewing all articles
Browse latest Browse all 1079

Trending Articles