Why does vertical sync cause mouse lag?

dguy6789

Diamond Member
Dec 9, 2002
8,558
3
76
So why does it? I've been having to live with tearing for a while now because of the small input delay that enabling vsync causes. I would have thought that by now they would have fixed it. Is it impossible to fix? Anyone know?
 

talonz

Junior Member
Jun 2, 2008
23
0
66
Do you have triple buffering enabled? It will make everything lag by 1 frame.
 

dguy6789

Diamond Member
Dec 9, 2002
8,558
3
76
I was only checking for the problem in UT3. Even if triple buffering mostly solves the problem in Opengl, it doesn't help me in DirectX games.
 

Majic 7

Senior member
Mar 27, 2008
668
0
0
You can use RivaTuner for this. Just use the D3DOverider app and it enables vsync with triple buffering in DirectX games. You don't have to have RivaTuner running. Newest version doesn't force triple buffering in games that don't support it.
 

ShawnD1

Lifer
May 24, 2003
15,987
2
81
Originally posted by: dguy6789
So why does it? I've been having to live with tearing for a while now because of the small input delay that enabling vsync causes. I would have thought that by now they would have fixed it. Is it impossible to fix? Anyone know?

Are you using a Nvidia card? In the options you can set it to render up to 8 frames in advance and it can really screw up the response time.
 

dguy6789

Diamond Member
Dec 9, 2002
8,558
3
76
AMD video card, 4870. I haven't seen Direct3D triple buffering as an option in their drivers ever. I've only seen it in nvidia drivers. Thanks for the recommendation, Majic 7. I will try it out :)
 

orborborb

Junior Member
Oct 3, 2007
3
0
0
I've been obsessing over this issue for awhile. I have a ATI 4850, XP SP3. Neither in OpenGL (Doom3 engine games) nor in DirectX with D3DOverrider does enabling triple buffering reduce the lag appreciably.

However, in the occasional game that allows you to limit the max framerate, setting that framerate limit to less than your refresh rate is the only thing I've found to allow Vsync without lag. In UT3 it's "MaxSmoothedFrameRate" in the UTEngine.ini file. In Half Life 2 it's "fps_max" (which they got rid of in Left 4 Dead for some reason)

I've even tried changing the "flip queue" size in ATI Tray Tools (supposedly the ATI equivalent of prerendering frames) with no luck in getting rid of the lag. I would love to hear from anyone who understands this issue better!
 

ShawnD1

Lifer
May 24, 2003
15,987
2
81
Originally posted by: orborborb
However, in the occasional game that allows you to limit the max framerate, setting that framerate limit to less than your refresh rate is the only thing I've found to allow Vsync without lag. In UT3 it's "MaxSmoothedFrameRate" in the UTEngine.ini file. In Half Life 2 it's "fps_max" (which they got rid of in Left 4 Dead for some reason)

Do you experience weird input lag in those particular games? I have UT3, and HL2, and L4D, but I've never experienced input lag in those games when using default video card settings. This might be an ATI specific issue since I'm using a Nvidia video card, or it's possible you've changed some important setting without realizing it.

Does this problem exist when you set all video card settings to let the application decide?
 

dguy6789

Diamond Member
Dec 9, 2002
8,558
3
76
D3DOverrider does decrease the lag noticeably for me, but it's still there. It's too much for me to tolerate while playing, so I'll just continue to leave it off.
 

orborborb

Junior Member
Oct 3, 2007
3
0
0
Originally posted by: ShawnD1
Do you experience weird input lag in those particular games? I have UT3, and HL2, and L4D, but I've never experienced input lag in those games when using default video card settings. This might be an ATI specific issue since I'm using a Nvidia video card, or it's possible you've changed some important setting without realizing it.

Does this problem exist when you set all video card settings to let the application decide?

Yes source engine and unreal engine 3 games have always had the vsync lag for me, though not as badly as doom 3 engine games or older quake 3 and unreal 2 games. Triple buffering seemed to slightly alter the lag although I could have been imagining it, but my trick of limiting the framerate below 60hz absolutely got rid of the lag (in unreal 3 i just needed to set it to 59.9, in half life 2 something like 57 or 58 fps was better). Of course limiting the framerate like that causes some hitches, but they are less offensive than the tearing or the lag.

I've used every version of the ATI drivers for the last 6 months, both with ATI Tray Tools and with CCC, even used driver sweeper between updates a couple times. Never any change in the 'lag with vsync' issue.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
Vsync causes input lag because the rendering system has to stall if both buffers are full but no refresh cycle is currently available. In theory triple buffering solves this problem because it allows the rendering to continue at the expense of dropped frames, but in practice I?ve found it can make the lag worse.

OpenGL games like Quake 3 and Unreal have horrific input lag with vsync + triple buffering compared to an uncapped double buffered system. I just put up with the tearing as I hardly ever see it, and it?s far more preferable to input lag.

And yes, pre-rendered frames can impact vsync?s input lag. In particular, I?ve found OpenGL games have significantly less lag with a value of zero, though input still isn?t as snappy as an uncapped system.

Be careful with setting D3D titles to zero on nVidia?s cards, as last time I checked doing so can BSOD the system. You should definitely lower the D3D value from 3 to 2 though, even if you don?t use vsync.

Also keep in mind that setting the pre-render value too low can cause games to stutter and hitch because they become rendered in a more ?just-in-time? approach, so any fluctuations will affect them more.
 

orborborb

Junior Member
Oct 3, 2007
3
0
0
Thanks for the explanation. So I assume the limiting framerate trick allows vsync to work without adding much lag because it prevents the buffers from filling up, but there is no way in either ATI or Nvidia's drivers to solve the issue for games which don't have a built in way to cap their framerates?

Now someone will just have to explain why on earth developers have REMOVED the FPS limiting capabilities of their engines in games such as Bioshock and Left 4 Dead! Although the tearing doesn't bother me too much in those games compared to the locked at 60hz but out-of-sync Doom 3 engine where I can watch the tear crawl up and down the screen constantly. And then there's the games which have bugs when playing with vsync turned off, unreal engine 1 games have sped-up gameplay at high framerates, deus ex 2's physics operate too quickly without vsync, and I'm sure there's more.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
Originally posted by: orborborb

So I assume the limiting framerate trick allows vsync to work without adding much lag because it prevents the buffers from filling up,
I?d guess so, yes. In general framerate caps don?t add input lag like vsync because games are better at internally stalling themselves than a display driver trying to externally stall them.

Now someone will just have to explain why on earth developers have REMOVED the FPS limiting capabilities of their engines in games such as Bioshock and Left 4 Dead!
I?d need to check more closely, but I'm pretty sure all UT3 engine games have a framerate limiter of some kind. I had to remove one from UT3 to get it to go over 60 FPS.

But yeah, it'd be nice in all games since a lot of them break under a high framerate, and caps don?t generally cause input lag like vsync. I cap many old games to 120 FPS whenever I can for compatibility reasons. That includes Quake 3, and I find it doesn?t hamper input at all compared to using vsync.
 

chizow

Diamond Member
Jun 26, 2001
9,537
2
0
Originally posted by: orborborb
Thanks for the explanation. So I assume the limiting framerate trick allows vsync to work without adding much lag because it prevents the buffers from filling up,
Not quite, there's less input lag simply because capping FPS normalizes your frame delay to closer match your actual refresh rate, thereby normalizing any input delay. The problem with input lag when you enable Vsync is due to the delay from faster frame rates being held to sync to a slower refresh rate. Capping FPS to match refresh more closely simulates uncapped FPS and no Vsync where frames are allowed to display as fast as they are rendered. When you cap FPS you'll always get ~17ms of delay for both frames and input polling (not lag).

For example, if you have 60FPS refresh, your ideal frame delay is 16.67ms (1000/60). If your GPU is rendering at say 90FPS, you may be getting 1 frame at 16.67ms, then 2 frames within the next 16.67ms (when the next frame is displayed), say one at 2ms and another at 10ms. If the first of those two frames is being held in the buffer as the next rendered frame, you may be getting up to 14ms of delay before that frame is displayed. That entire 14ms is going to be input lag. If your GPU is capped to 59-60FPS it should be rendering just ahead of your monitor's refresh with perhaps only a 1-2ms delay between render and display, meaning very little input lag. If Triple Buffering is enabled and your GPU driver can decide which frame to render, the first or second, you may actually see less input lag than without Triple Buffering. If the driver always takes frames in-order, then you may see more input lag.

but there is no way in either ATI or Nvidia's drivers to solve the issue for games which don't have a built in way to cap their framerates?
Actually I do believe Nvidia's driver does sync/cap frame rates to 60 vs. just taking frames in-order to a 60Hz cap. Enabling Vsync in Nvidia's driver simply results in much less input lag than enabling Vsync in-game for many titles. Some of the most noticeable I've seen first-hand or read about would be Fallout 3 and Dead Space, but there's a pretty noticeable difference in any game I use Vsync. In the example of Dead Space, keep in mind this game gets in the high 100/200s for FPS so you can imagine the kind of input lag going by the above example.

In general, I always force On Vsync in the NV CP game profile if I want to use Vsync. If the game is generally over 60FPS and I want Vsync, I don't use Triple Buffering as that tends to reduce input lag further, and also uses less VRAM. If the game dips between 30 and 60FPS often, then I'll force Triple Buffering on as frames don't drop from 60 to 30 constantly.
 

josh6079

Diamond Member
Mar 17, 2006
3,261
0
0
Originally posted by: dguy6789
AMD video card, 4870. I haven't seen Direct3D triple buffering as an option in their drivers ever.

If you make a profile for your game in ATi Tray Tools you can force Triple Buffering for Direct3D. However, currently it only works for DirectX8 and 9.


ATi Tray Tools > Game Profiles > Manage Profiles > Direct3D Tweaks tab and select the Triple Buffering checkbox.