Game Development Reference
In-Depth Information
The first parameter defines the sync interval, and this is where you would enable or
disable VSync. The interval can be any positive integer, and refers to how many re-
freshes should complete before the swap occurs. A value of zero here will result in
VSync being disabled, while a value of one would lock the presentation rate to the
monitor refresh rate. You can also use a value above one, which will result in the re-
fresh rate being divided by the provided interval. For example, if you have a monitor
with a 60 Hz refresh rate, a value of one would present at 60 Hz, while a value of two
would present at 30 Hz.
At this point, we've done everything we need to initialize and render a frame;
however, you'll notice the generated code adds some more lines, as shown in the
following code snippet:
m_d3dContext->DiscardView(m_renderTargetView.Get());
m_d3dContext->DiscardView(m_depthStencilView.Get());
These two lines allow the driver to apply some optimizations by hinting that we will
not be using the contents of the back buffer after this frame. You can get away with
not including these lines if you want, but it doesn't hurt to add them and maybe reap
the benefits later.
Search WWH ::




Custom Search