Game Development Community

GFXFence... what exactly is it?

by Manoel Neto · in Torque Game Engine Advanced · 02/13/2009 (12:43 pm) · 2 replies

I've been hearing the word "fences" a lot in 1.8 and 1.8.1 threads, but no clear explanation of what they are used for.

I've been digging the 1.8.1 source, and it seems that they ultimately have the same goal as the old killFramesAhead pref - preventing the input lag and intermittent frame rate hiccups by locking and unlocking the buffer (the fences seems to be able to do this for multiple render targets). Is this correct, or they do something else?

#1
02/14/2009 (5:29 pm)
That sounds for the most part correct. My understanding is that ultimately they are there to keep both the cpu and gpu in harmeny with each other. This way one will not get so far ahead of the other that you end up with input lag, and so forth strange things that happen when they are out of sync with each other.
#2
06/19/2009 (12:52 am)
From MS docs:

"The DirectX graphics kernel subsystem calls the display miniport driver's function to queue the DMA buffer to the GPU execution unit.
Each DMA buffer submitted to the GPU contains a fence identifier, which is a number.
After the GPU finishes processing the DMA buffer, the GPU generates an interrupt."

So i believe the fence is used by the driver to write into the buffers.
If buffers are queued,it writes to a temp ring buffer.
This way the cpu and gpu are in sync.