How to add vertical synchronization to windowed D3D application?

Started by
1 comment, last by Malder1 18 years, 8 months ago
Please advice me how to write maximally fast realization of vertical synchronization in windowed Direct3D application? I found two variants: 1) D3DSWAPEFFECT_COPY_VSYNC flag 2) Or read GetRasterInfo and wait when current scanline will be at 0 position. In both cases we lost time, because we need to wait, unlike fullscreen mode where we can use triple buffering.
Advertisement
You could use IDirect3DDevice9::GetSwapChain to get the swap chain for your windowed device, then use the extra D3DPRESENT_DONOTWAIT flag with the IDirect3DSwapChain9::Present method.

The Present call will then return D3DERR_WASSTILLDRAWING until the presentation has been synchronised with the VSYNC; when your application recieves D3DERR_WASSTILLDRAWING, it can perform other (non-D3D) processing with the CPU.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Thank you for your quick response!

Unfortunately I still use Direct3D 8.0, because we're creating multimedia application and need more wide compatibility.

I could use fullscreen mode, but screen may blinks on some systems and ATI has doubt option which allows to change color settings specially in fullscreen games. So our multimedia application also will have damaged colors. As you know all games made in dark colors, and users often change color settings for games, but usual application and photos has usual optimal brightness.


This topic is closed to new replies.

Advertisement