Archived

This topic is now archived and is closed to further replies.

pimstead

Why use DDFLIP_WAIT for DX flipping operations?

Recommended Posts

When I don''t use this flag then DX doesn''t wait for vsync to do the page flip. On my crappy vid card this means the frame rate goes from 60fps(refresh rate) to 100fps. I don''t see any tearing so why even use the wait flag? Any info could help. Thanks.

Share this post


Link to post
Share on other sites
Is the app running in Fullscreen or windowed mode?

If its running Fullscreen mode, the FPS should be limited to the refresh rate of the monitor (60-75) unless VSync has been disabled by your video card drivers/Display settings.

If its running in Windowed mode, vsync limiting wont work because Windows controls the screen updating withing the GDI.

You are probably not seeing tearing either because your app is not graphically intensive with alot of updating or the FPS isnt high enough to notice it. My GeForce can pump 400FPS and tearing is very noticable.

The DDFLIP_WAIT isnt related to the VSync anyway, what DDFLIP_WAIT means is that if flip fails when you call it, it will loop and retry the flip process until it succeeds. Disabling this flag may cause problems if you are locking/blitting many surfaces, and will cause some of your frames not to show.

Use ->WaitForVerticalSync() before you call ->Flip() to wait for the screen VSync.

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
the program is a fullscreen app. However I wasn''t ever waiting for VSYNC I was just assuming that Flip wouldn''t flip with the Wait flag unless you were at VBlank (which I am almost sure that it does). Like I said the app runs at 60fps with the flag and 100fps without. So I dont get it. I have a moving sprite and background drawn every frame that does not tear at 100fps.

As far as waiting for VSYNC that turns out to slow my program to 30fps. Well not exactly, let me explain. I am a console game programmer for the AGB. Waiting for VBlank is a good thing where you definitely have parts of the program run during display time and parts of the program that run during VBlank. So to write code like this using DX you would use:

DDObject->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL);
// code here for VBLANK period
DDObject->WaitForVerticalBlank(DDWAITVB_BLOCKEND, NULL);

The program will stay at 60fps if I only wait for BLOCKBEGIN. However if I do as it is shown above and wait for begin, run code, then wait for end before returning to the main loop, the fps drops in half to 30. I know what you are thinking. If you overrun the VBlank period then BLOCKEND will not happen until the subsequent frame. However trying this example the only thing that I have during VBlank is Flip, then Clear the back buffer. That''s it. There is no way that these two things take longer than the VBlank period. So why does it cut the frame rate in half?

Thanks for any other help.

Share this post


Link to post
Share on other sites
Flip is automatically doing a vsync. By calling WaitForVerticalBlank, you are waiting for 2 vblanks. In order to disable vysnc, you should pass the follwoing OR''d flags to Flip: DDFLIP_WAIT | DDFLIP_NOVSYNC. You should always use DDFLIP_WAIT--otherwise you may see some frame skipping occur because the Flip failed. And I wouldn''t skip the VSYNC anyway. What''s wrong with 60 fps?

Share this post


Link to post
Share on other sites
You do not need to use WaitForVBlank. Just use DDFLIP_WAIT. Although it makes the FPS drop to the refresh rate of the monitor and factors thereof if the games frame rate interferes (the FPS can flip rapidly between 60 and 30 if your fps is 45).

Share this post


Link to post
Share on other sites
You are making me a bit confused here. I am using D3D and I have the same problem with the vertical sync. I have problems while using DDFLIP_WAIT. It doesn''t seem to wait for vertical retrace at all. There is absolutely no change at all if I change the value to DDFLIP_INTERVAL4.

Best Regards
Fredrich

Share this post


Link to post
Share on other sites