|
vsync |
Kauhiz
Member #4,798
July 2004
|
I was using page flipping before, but changed to double buffering, because of transcluency. I forgot to call vsync before drawing and my fps was around 45. If I add vsync the fps drops to well below 30. Do I really have to call vsync before the screen update? --- |
Richard Phipps
Member #1,632
November 2001
|
Not really. It can help reduce tearing with double buffering, but I found it makes the tearing more obvious on my PC. Make it a user selectable option if you like.. |
Sirocco
Member #88
April 2000
|
Quote: ot really. It can help reduce tearing with double buffering, but I found it makes the tearing more obvious on my PC. How is that possible? If vsync is supported and properly used it will completely eliminate tearing, but you may get a low(er) frame rate. --> |
Richard Phipps
Member #1,632
November 2001
|
When I use vsync it seems that the timer is not 100% accurate as such I see a tearing with scrolling approx 1/8th of the way down the screen and this slowly moves down the screen. Without vsync this tearing is in a different place vertically each frame and so is less noticable. |
decsonic
Member #4,150
December 2003
|
AFAIK allegro waits for a vsync before flipping pages. Programmer's paranoia: Don't trust anybody's code, not even your own. |
gillius
Member #119
April 2000
|
Richard, you are using vsync after you have drawn to the double buffer but right before you blit it to the screen? If your game is executing in constant time, and takes too long to blit, you will see a tearing always in the same spot, as you describe. That is because you are drawing only the first 1/8th of the screen before the vsync period ends and the gun reaches that point on the screen. If you are really executing that slowly, that means you are probably getting like 1/16th of your refresh rate as frames. At 60hz that means it is taking you 8 refreshes and 9 vertical syncs to draw a frame, or 130ms per frame, just to draw. That's pretty extreme. That's less than 10fps, and that's not even including the logic. Gillius |
Richard Phipps
Member #1,632
November 2001
|
With vsync I get 75fps. Without I get over 250+ fps. |
23yrold3yrold
Member #1,134
March 2001
|
Quote: With vsync I get 75fps. Without I get over 250+ fps. Since you're monitor obviously has a refresh rate of 75, your 250+ is still only 75. Just without possible tearing. -- |
Richard Phipps
Member #1,632
November 2001
|
I know that.. I only mentioned it to illustrate how fast the game runs when not restricted to the frequency of the monitor update. |
Sirocco
Member #88
April 2000
|
Do you have a Radeon card? I've actually seen something very similar to that when using vsync in lower resolutions on a Radeon 7500. I'm happy to say that my 9200 doesn't have that problem ^.^ --> |
Yves Rizoud
Member #909
January 2001
|
Richard Phipps said:
With vsync I get 75fps. Without I get over 250+ fps. This statement confuses me... I assume that during normal game, the logic is not linked to the display speed (I hope...) But "how fast the game runs when not restricted (...)" ? If your screen has a rate of 75Hz, displaying more than 75 frames per second is NOT faster, it's only more CPU/memcopy stress... If that's your "logic" step you want to profile, disable the display completely, or lock it at 75 fps "only"... An arcade game can easily reach 4-digit BPS count... Last time I profiled my game, I got something like About display "shearing": drawing "as often as possible" in video memory is certain to cause it. You can fix the shearing by waiting for a vsync, IF (Sirocco, here's the catch: ) you can do all graphic operations in less time than what the monitor spends on moving back the "ion cannon" to the top of the screen : This time interval is half of screen frequency time, or even less... |
Richard Phipps
Member #1,632
November 2001
|
Sirocco: Geforce 4 MX440SE. Yves: vsync() waits until the next vertical blank (supposedly, I suspect on some cards this is emulated with a slightly inaccurate timer). That is why I said the game speed is restricted with vsync, because the function doesn't waits before returning. |
Yves Rizoud
Member #909
January 2001
|
slightly inaccurate timer ? |
imaxcs
Member #4,036
November 2003
|
Why even use vsync() when you do double buffering?
|
X-G
Member #856
December 2000
|
To reduce tearing. -- |
imaxcs
Member #4,036
November 2003
|
I also use double buffering without vsync() and it works perfectly!
|
X-G
Member #856
December 2000
|
Aren't you lucky. Not everyone is. Double buffering without vsync can lead to evil-ass tearing on some setups. -- |
ReyBrujo
Moderator
January 2001
|
Especially in old computers which are not able to display a frame as fast as you request it to do. -- |
imaxcs
Member #4,036
November 2003
|
Quote: Aren't you lucky.
|
23yrold3yrold
Member #1,134
March 2001
|
It's like that crash bug in your Asteroids game, imaxcs; just because it works on your computer doesn't mean it works on everyone else's. -- |
Richard Phipps
Member #1,632
November 2001
|
I think giving the user the choice of vsync or not is best. Offering Page Flipping and Triple Buffering is even better though. |
X-G
Member #856
December 2000
|
Quote: I think giving the user the choice of vsync or not is best Not just that, I'd consider it very rude not to give me that choice, considering how ridiculously easy it is to disable, code-wise. -- |
23yrold3yrold
Member #1,134
March 2001
|
Quote: considering how ridiculously easy it is to disable, code-wise. Heh; I added the ability to toggle vsync() to my screen update API, not because I had a need for it, but just because it was so little effort. -- |
imaxcs
Member #4,036
November 2003
|
23 said: It's like that crash bug in your Asteroids game, imaxcs; just because it works on your computer doesn't mean it works on everyone else's.
X-G said: Not just that, I'd consider it very rude not to give me that choice, considering how ridiculously easy it is to disable, code-wise. Then I will do that too! Again, something learned!
|
Cody Harris
Member #4,406
March 2004
|
Tearing??? What exactly is that?? I've never heard or seen anything of the likes.... My games work the same with or without vsync(), I don't notice a diff except for a slight FPS drop. --------------------------------- |
|
|