Talk:VSYNC vs WAIT/@comment-15296152-20141209181605

The difference between WAIT and VSYNC is where they each continue executing code after their pause session. The hardware has what is known as a VBlank, which is a period between the last rendered scanline and the first rendered scanline which is around 71 scanlines in length (the DS/DSi has a total of 263 scanlines. 192 visible, 71 invisible). Within this VBlank, developers can update their graphical elements without having it "tear" on the screen, because it rendered from left-to-right by pixel, top-to-bottom by scanline. Most modern GPUs utilize double-buffering, which is two grapic buffers the size of the screen, and the system displays one while it renders graphics to the other. Once the target rendering buffer is complete, the system swaps the buffers, so it's vice versa of what gets displayed and what gets rendered to (kinda like with GPAGE, which has a "display" parameter, and a "write" parameter). The DS/DSi can do this, but for it's 2D hardware like Backgrounds and sprites (and even the 3D hardware), it does not rely on double buffering, so it has to update it's graphical elements within the VBlank.

So, the difference between WAIT and VSYNC? WAIT pauses a full duration of a frame, starting at whatever scanline the code was executed, and waits until the system returns back to that scanline. VSYNC, on the other hand, always resumes at the beginning of the VBlank section, whether it's at scanline 192 (which is where VBlank begins), 250 (within the VBlank), or scanline 7 (near the top of the display). VSYNC insures that you can maintain 60fps, whereas WAIT cannot.