In computer graphics, triple buffering is a variant on double buffering, a technique for drawing graphics that shows no (or less) flicker, tearing, and shearing artifacts.
Triple buffering attempts to provide a speed improvement over double buffering. In real life applications, this often involves trying to abstract[clarification needed] the graphics drawing operations from being synchronized with the monitor's refresh rate. Typically this involves frames being drawn at a rate lower than or higher than the monitor's frame rate (a variable frame rate) without the usual effects this would cause (namely flickering, shearing and tearing).
Due to the software algorithm not having to poll the graphics hardware for monitor refresh events, the algorithm is free to run as fast as possible. This is not the only method of triple buffering available, but is the most prevalent on the PC architecture where the speed of the target machine is highly variable.
Another method of triple buffering involves synchronizing with the monitor frame rate, and simply using the third buffer as a method of providing breathing room for changing demands in the amount of graphics drawn. This is the use of a buffer in the true sense whereby the buffer acts as a reservoir. Such a method requires a higher minimum specification of the target hardware but provides a consistent (vs. variable) frame rate. This is the case when using triple buffering in DirectX, where a chain of 3 buffers are rendered and always displayed.
Triple buffering implies three buffers, but the method can be extended to as many buffers as is practical for the application. Usually, there is no advantage to using more than three buffers.
Contents |
Variants
Page flipping triple buffering
Using page flipping triple buffering, two buffers are used as back buffers, and one as the front buffer. One back buffer is used by the software to draw the next screen, while the other back buffer holds the last complete screen. When the software has finished drawing a screen it flips both back buffers. That way the software can render screens as fast as it can.
The third buffer, the front buffer, is read by the graphics card to display the image on the monitor. Once the monitor has been drawn, the front buffer is flipped with the back buffer holding the last complete screen. Since one of the back buffers is always complete, the graphics card must never wait for the software to complete. Consequently, the software and the graphics card are completely independent, and can run at their own pace. Finally, the graphics card will always be able to display a recent screen, with limited lag.[1]
Render ahead triple buffering queue
A render ahead queue is made of a circular queue. When the circular queue is made of three buffers, it is also called a triple buffering. However it lacks many advantages of the page flipping triple buffering. As long as the queue is not full (i.e. some buffers are still free), the software can render screens. When a screen is completed, the software will fill the next available buffer with a new screen. At the other end, the graphics card will consume completed buffers, one at a time. If the circular queue is made of a fixed number of buffers, the drawing frequency of the software cannot be greater than the frequency of drawing of the graphics card. Another disadvantage of this method is the increased lag. Indeed, since all buffers of the circular queue will be displayed, the longer the circular queue, the greater the lag.[2]
Double buffering vs Triple buffering
Limitations of double buffering
If the system has two color buffers A and B, it can display buffer B while drawing a new picture (rendering) into buffer A. When it is done rendering into buffer A, the system needs to wait until buffer B is in the monitor's vertical blank period before swapping buffers. This waiting period could be several milliseconds during which neither buffer can be touched. At 60 frames per second, there are only 16.67 milliseconds in which to draw the frame, so this delay could waste valuable frame time. When the monitor is in vertical blank it can either swap buffers A and B and then start rendering into buffer B (page flipping) or copy buffer A into buffer B and render into buffer A.
Advantage of triple buffering
If the system has three color buffers A, B and C, it does not have to wait to swap buffers. It can display buffer B while rendering into buffer A. When done rendering into buffer A, it can start rendering into buffer C immediately. When the monitor is in vertical blank, it can display buffer A and make buffer B available for reuse.
Also, on systems like Amigas, you could paint using the CPU in parallel with the blitter doing a cleanup of a previous buffer, meaning that you could show buffer A, while cleaning buffer B and paint graphics on buffer C. If you only used two buffers, you would have to make sure the cleaning was completely done before starting the drawing on the unused buffer, which would waste some time.
Limitations of triple buffering
If the system always renders buffers in less time than it takes to display a buffer once on the monitor, the computer will wait for the monitor regardless of how many buffers there are. In this particular case triple buffering has no advantage over double buffering. The third buffer also uses additional memory, which could be used for other data (like textures).
Thirdly, if the system is interactive (for example, a simulator or a video game), and using triple buffering as a fixed order reservoir, triple buffering increases the average delay between the input controls being read and visual feedback being presented to the user. In the other case where frames can be dropped without being displayed, triple buffering can actually lower response time by including input data which wasn't available when the previous dropped frames were rendered.
See also
External links
- Triple buffering: improve your PC gaming performance for free by Mike Doolittle (2007-05-24)
- http://www.tweakguides.com/Graphics_10.html
References
- ^ "Triple Buffering: Why We Love It". AnandTech. June 26th, 2009. http://www.anandtech.com/video/showdoc.aspx?i=3591&p=1. Retrieved 2009-07-16.
- ^ "Triple Buffering: Why We Love It". AnandTech. June 26th, 2009. http://www.anandtech.com/video/showdoc.aspx?i=3591&p=1. Retrieved 2009-07-16.
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)




