## Hardware Triple Buffering

Hardware triple buffering is supported in the SciTech SNAP Graphics Architecture specification by allowing the application to schedule a display start address change, and then to later determine the status of the last scheduled display start address change. The SetDisplayStart function is used to schedule the display start address change, and the GetDisplayStartStatus function is used to determine the status of the last scheduled change. The following steps outline how to use hardware triple buffering:

1. Display from the first visible buffer, and render to the second hidden buffer.

2. Schedule a page flip for the second hidden buffer that you just finished rendering with a call to SetDisplayStart with the waitVRT flag set to 0, and start rendering immediately to the third hidden buffer. The CRT controller will be currently displaying from the first buffer.

3. Before scheduling the page flip for the third hidden buffer, wait until the last scheduled change has occurred by calling GetDisplayStartStatus until it returns non-zero. Schedule the page flip for the third hidden buffer (call SetDisplayStart with the waitVRT flag set to 0 again) and immediately begin rendering to the first hidden buffer. The CRT controller will be currently displaying from the second buffer.

4. Repeat step 3 over and over cycling though each of the buffers.

Although the above method does require a spin loop polling on the GetDisplayStartStatus, in most cases when this function is called the page flip will already have occurred and the spin loop will time out immediately. The only time that this cannot occur is if the application is drawing at a frame rate in excess of the current hardware refresh rate (i.e.: in excess of 60-85 frames per second), and the resulting frame rate for the application will be pegged at the hardware refresh rate.

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com