0
\$\begingroup\$

This is more a theoretical question. This is what I understand regarding buffer swapping and vsync:

I - When vsync is off, whenever the developer swap the front/back buffers, the buffer that the GPU is reading from and sending to the monitor will be changed to the new one, regardless if the old buffer was being read (i.e. no vblank is needed).

II - When vsync is on, the buffers are not immediately swapped, they will only be changed when the old buffer was completely read (i.e. vblank is needed).

III - Turning vsync off can boost the frame rate to be greater than the monitor refresh rate, but screen tearing can appear when buffers are swapped when they are being read

IV - Turning vsync on prevents tearing, but the monitor refresh rate limits the FPS.

Based on this I tried to do the following experiment: I disabled vsync and rendered a simple glClear + glClearColor every frame, with a new random color per frame. I got ~2400FPS in a 60Hz monitor. Since every frame I swapped the buffers, and since the monitor takes 1/60 second for each full screen drawing, I was expecting that each time the monitor was being refreshed, the buffers would have been swapped roughly ~40 times. This is because in 1/60s, there are around 40 buffer swapping calls. Since everytime the buffers are swapped the clear color is different, I was expecting to see a really messy image, with lots of different colors, because of the tearing. Instead, by taking some screenshots I didn't see any tearing... every pixel had the same solid color.

Could someone point the wrong assumptions that I had and why I see such behavior?

Thanks in advance!

\$\endgroup\$
1
\$\begingroup\$

The problem was related to the window manager. I could see the expected behavior when I ran in full screen.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.