Triple buffering

from Wikipedia, the free encyclopedia

Triple buffering (English triple buffering ) describes a method of computer graphics , in which graphics card may include three sequential images simultaneously. The aim of the method is to be able to calculate a third image when using VSync (vertical synchronization) while a first image is still displayed and a second is waiting to be displayed by waiting for the image blanking interval. Double buffering ( double buffering ) waits here for the full display of the first image and thus wasted computing time.

The difference between double and triple buffering lies in the division of the frame buffer. While the framebuffer consists of two buffers (front and back buffers) with double buffering, there are three with triple buffering (one front buffer and two back buffers).

In the case of interactive displays (DVD or Bluray display), significantly more images can be precalculated to prevent bottlenecks.

functionality

The image that is currently being displayed on the screen is in the front buffer. The next image is rendered (calculated) in back buffer 1 . The further process depends on when the swap command is implemented. This is initiated by the GPU when the next frame is ready for output and causes the memory addresses of the front and back buffers to be swapped ( page flip ).

  • This process corresponds to VSync = off:
    The swap command is implemented in back buffer 1 as soon as the calculations are completed, thus swapping the front and back buffers. This can lead to so-called tearing , in which the image displayed on the monitor from u. U. there are several consecutive frames. The back buffer 2 remains unused with this combination. Triple buffering without VSync is a waste of resources.
  • This process corresponds to VSync = on:
    the calculations in backbuffer 1 are completed and the rendering of the next image in backbuffer 2 has already started. The swap command is now implemented . The new front buffer (formerly back buffer 1) contains the fully calculated image and is displayed on the monitor. The next frame is calculated in the new back buffer 1 (formerly back buffer 2). The new back buffer 2 (formerly front buffer) has been deleted and is ready for further use.

Double buffering and VSync

By using VSync, the swap command, which swaps the front and back buffers, is not implemented until the current image from the front buffer has been completely displayed on the screen. If the calculation of the new frame in the back buffer has been completed, the GPU has to wait until the next VSync to continue with the next frame. The effective computing time per image is therefore always equal to or a whole multiple of the time that the monitor needs to display an image. For example, if the GPU's frame rate is just below the monitor's, the effective frame rate is only half the monitor's frame rate (since the GPU has not finished rendering the image every other VSync). If it is below half it becomes a third of the monitor frame rate, etc.

Triple buffering and VSync

The frame rate of the monitor can be decoupled from the GPU by an additional back buffer. When an image is finished, the GPU no longer has to wait until the swap command is executed, but can continue working directly in the other back buffer. When the swap command occurs, the two back buffers are swapped, while when VSync occurs, the front buffer and the (last) fully calculated back buffer are swapped. So there is no loss of performance compared to the unbuffered case.

Advantages and disadvantages of triple buffering and VSync

advantages

  • optimal image quality as there is no tearing (graphic artifact if several consecutive images are used during image output)
  • no loss of performance

disadvantage

  • Slightly increasing and more fluctuating latency (up to the duration of a frame)

comment

  • With Freesync or G-Sync there is no longer any triple buffering and this is no longer necessary. Images are displayed when they have been completely calculated or when the upper limit of the frame rate has been reached.

Web links