i hate how every time i read about frame buffers i just end up having more questions and becoming more confused. is there a resource that better explains this stuff with pictures
im a visual learner.
I'm sure someone could do that with a bit of work, but I see it like this
Double buffer situation
Frame 1
1: Display Output Hardware -> Buffer A
2: Rendering Hardware -> Buffer B
In a 60fps situation, 1 wants to know where in memory it should start fetching data from every 16ms. In this case Buffer A.
As the display output hardware is sending data to the display device, the game is rendering the next frame in 2 or Buffer B.
If the game can render Buffer B faster than 16ms, when the display output hardware asks for a new position in memory to start outputting from, the game tells it to now look at Buffer B, as it is finished. So..
Frame 2
1: Display Output Hardware -> Buffer B
2: Rendering Hardware -> Buffer A
Then the cycle repeats with the display output hardware sending data from Buffer B to the display device and the game renders the new frame on top of Buffer A without clearing it.
In the situation now where the display output hardware asks for a new position, and the rendering hardware has not finished with Buffer A, two things can occur. It can either swap the two regardless, but then part of Buffer A will still have data from Frame 1, inducing a tear, or it can let the display output hardware show Buffer B for a second time while it finishes with Buffer A.
When this happens, the display output hardware may only be say 5% into sending out the data from Buffer B when the game has finished rendering into Buffer A. It now has to wait 95% of a frame before it can do anything more - when they are finally swapped again.
If I'm right the following happens.
Triple buffer situation
Frame 1
1: Display Output Hardware -> Buffer A - Blank, totally black.
2: Middle Buffer B - Totally black.
3: Rendering Hardware -> Buffer C
The display output hardware shows a blank screen - Buffer A. In the mean time, the rendering hardware is rendering into Buffer C. If when the display hardware asks for a new cycle, it is given Buffer B. So you get this situation:
Frame 2
1: Display Output Hardware -> Buffer B - Blank, totally black.
2: Rendering Hardware -> Buffer C
3: Old Buffer A - now the back buffer.
The display output hardware is now sending data to the display, again a total blank. In the mean time, the game finishes off rendering into Buffer C. Once this is done, the game starts rendering the next frame into Buffer A. If at any point, when the display output hardware requests a new frame, and 2 is not complete, it's forced again to display 1 twice.
So, in these circumstances, if your renderer misses say 20% of the 60fps in a triple buffer situation, it will still output a higher fps than 30, as it never has to stall and entire frame for up to 99% of a frame waiting for the next swap with the front buffer. It can finish what it was doing and then get on with rendering into the third frame buffer.