Posted on

Understanding Triple Buffers


A Little Background

In most of the cases gamers fall into situation where they enable the V-Sync to defeat the frame tearing and stuttering while playing games. The result is the drop in frame rate and killing the overall game play! A good game play would have a max of 60 FPS. But you get alert when the frame rate falls to 30 FPS or below. The immediate remedy they choose is to reset the settings. This is due to lack in right information.

The fall in frame rate is caused not by V-sync alone but V-sync and default Double Buffering. In Double Buffering there are two buffers in the GPU, the monitor show the image in the front buffer and the next rendered frame is in the back buffer. When V-sync is enabled, before the GPU can swap the front and the back buffer, it needs to wait for the next vertical blank period (happens every 1/60th seconds on monitors with refresh rate 60Hz) to keep up synchronization with the monitor’s refresh rate. This process is smoother when the GPU can render frames faster than 60 FPS. Just  imagine what happens when the GPU is unable to render 60 FPS. When that happens, the GPU is unable to make the buffer swap because the next frame is not ready in the back buffer and it’ll have to wait for the next vertical blank period to make the swap. The result is that instead of swapping buffers 60 times per second, it’s only swapping the buffer 30 times a second, and that’s the reason frame rate is overlaid at 30 fps.

Triple Buffering Technique

Triple buffers are here to rescue! Since, now we have 3 buffers and the GPU can start rendering into the 3rd buffer without having to wait for the front buffer gets swapped out. It helps in improving the framte rate when V-Sync is also enabled. In short it pretty much negates any of the negative impacts of enabling v-sync (such as lower frame rates and input lag) while only taking up a small fraction of the texture memory in your video card. Both ATi and nVidia provide an option to enable triple buffering in their drivers. Unfortunately it’s only half right, the triple buffering option in their drivers only have effect in OpenGL games. Considering the numbers of OpenGL games is largely inferior to D3D games, it’s even less than half right!

If you want to exploit the power of Triple Buffering in your D3D application then you must use the D3DOverrider which is packaged along with Rivatuner, a famous tweaking tool for power tweakers. It also available as a separate tool which can be downloaded from here.

D3DOverrider is a program that forces triple buffering for direct3d games by calling directly the DirectX API. The purpose of this program is because nvidia and ati drivers only support triple buffering for opengl based games, leaving direct3d game developers the responsibility of providing this option. Unfortunatly, some games like COD: Modern Warfare 2 does not have this option and the only way to enable it is through this program. Sadly, this program injects itself into the memory when the game launches, and could quite possibly be mistaken for a hack or cheat, resulting in a wrongful ban.

Memory Footprint

Triple buffering seems like the perfect solution to cure low frame rate, however, it does not come free. Enable triple buffering also means it requires 50% more frame buffer spaces. Under certain conditions, it can also negatively impact your gaming experience. A simple example can illustrate this potential problem. Let’s say we are running a game at 1600×1200 resolution. Each pixel needs 32 bits to store the information, 1600x1200x32 = 61,440,000 bits, converting it to megabytes, it equals to 7.32MB. To use double buffering, it requires 14.64MB video memories; to use triple buffering, it requires 21.96MB video memories. Heck, it’s only 21.96MB, Not a big deal? Modern video cards have 256MB video rams onboard. You are certainly right, it does not seem like memory usage would be an issue. However, once we enabled 4x FSAA (Full Screen Anti-Aliasing), the number gets inflated really fast. With 4x FSAA enabled, there are 4 times more pixels being sampled, thus you need to multiple 21.96MB by 4 and it’s whopping 87.84MB! That’s more than 1/3 of your total video ram. If a game requires 200MB of space to store textures, light maps, bump maps, normal maps…etc., you are going to have a very bad gameplay experience with lots of pauses caused by hard drives accesses. This is just something to watch out for, if you find the game accessing the hard drive too frequently, it can be an indication that triple buffering is eating up too much of your video memories. So watch out for it.

D3DOverrider

For any further tweaking help follow:

http://blogs.techrepublic.com.com/window-on-windows/?p=616

[via]

 

Advertisements

About GPUToaster

https://gputoaster.wordpress.com/about

2 responses to “Understanding Triple Buffers

  1. Diceman2037 ⋅

    Direct3D does not have triplebuffering, it uses a frame queue, the more frames in a queue, the higher input latency becomes.

    • Thats correct! Technically speaking, Triple buffering generates a third frame in the frame buffer, so there is always a frame ready to be displayed as you said.

      As a matter of fact even OpenGL doesn’t support triple buffers. If the driver (Like nVIDIA)internally supports triple buffers then you can use it. And again FBO is used for triple buffering.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s