Trying to find out exactly how VSYNC works and its a bit like trying to find out "how a jet engine works" and being told "A jet engine produces thrust to make a plane fly" and like, yes I know what its for please tell me what the mechanism is.
@heals nowadays is most relevant but curious about both.
Basically curious if Vsync halts a program till it's ready to display the next frame, or can you just throw rendered frames at it? (i.e. if you're generating 120 frames every second, and its 60hz Vsync, you only see every other frame?)
vsync doesn't stop anything, if you grind out 400 FPS on a 60hz screen you simply throw away all of them (the higher your FPS the more likely you are to render a teared frame because you draw over it before it's fully on-screen). Nothing blocks you at any point unless you explicitly build your application or engine to do so itself and wait for a vsync signal to buffer swap.
[EDIT] that's why you commonly use double or multi-buffering so you can render as many off-screen frames as you want but only ever swap one buffer to be shown on-screen.
@heals Thank you! That is incredibly helpful. That seemed like what it *should* do but the internet was very vague on things and some people claimed the opposite.
@Tess: Tired, cold and sexy. @Heals in the old days it was when the electron beam was switched off whilst the magnets moved it back to the top of the frame.
You don’t get to delay it. It’s regular as clockwork. If you wanted smooth update, you waited for vsync and pointed your display hardware at the new content.
On very old school machines, you could time stuff so that you updated the screen behind the vertical scan.
And there were fun tricks you could do on old 8 bit machines to draw something, wait for the beam to hit a given scan line (some systems let you trigger an interrupt based on this), and then reconfigure the hardware, so you could have different parts of the screen in different graphics modes, and suchlike.
@goatsarah the original gameboy being one of those very famous devices. Even though it used an LCD display it technically had a vsync equivalent, would build the image top-to-bottom in scanlines (NES legacy that they somehow kept) AND give you an interrupt for each scanline so you could do exactly that 😀
Heals
in reply to Tess: Tired, cold and sexy. • • •Tess: Tired, cold and sexy.
in reply to Heals • • •@heals nowadays is most relevant but curious about both.
Basically curious if Vsync halts a program till it's ready to display the next frame, or can you just throw rendered frames at it? (i.e. if you're generating 120 frames every second, and its 60hz Vsync, you only see every other frame?)
Heals
in reply to Tess: Tired, cold and sexy. • • •vsync doesn't stop anything, if you grind out 400 FPS on a 60hz screen you simply throw away all of them (the higher your FPS the more likely you are to render a teared frame because you draw over it before it's fully on-screen). Nothing blocks you at any point unless you explicitly build your application or engine to do so itself and wait for a vsync signal to buffer swap.
[EDIT] that's why you commonly use double or multi-buffering so you can render as many off-screen frames as you want but only ever swap one buffer to be shown on-screen.
Tess: Tired, cold and sexy.
in reply to Heals • • •Sarah Brown
in reply to Tess: Tired, cold and sexy. • •@Tess: Tired, cold and sexy. @Heals in the old days it was when the electron beam was switched off whilst the magnets moved it back to the top of the frame.
You don’t get to delay it. It’s regular as clockwork. If you wanted smooth update, you waited for vsync and pointed your display hardware at the new content.
On very old school machines, you could time stuff so that you updated the screen behind the vertical scan.
And there were fun tricks you could do on old 8 bit machines to draw something, wait for the beam to hit a given scan line (some systems let you trigger an interrupt based on this), and then reconfigure the hardware, so you could have different parts of the screen in different graphics modes, and suchlike.
These techniques were used a LOT in the 80s.
like this
Tess: Tired, cold and sexy. and Heals like this.
Heals
in reply to Sarah Brown • • •@goatsarah the original gameboy being one of those very famous devices. Even though it used an LCD display it technically had a vsync equivalent, would build the image top-to-bottom in scanlines (NES legacy that they somehow kept) AND give you an interrupt for each scanline so you could do exactly that 😀
/cc @diffractie