Swap chain: Difference between revisions

Content deleted Content added
m cat
GreenC bot (talk | contribs)
Rescued 1 archive link. Wayback Medic 2.5 per WP:URLREQ#anandtech.com
 
(23 intermediate revisions by 19 users not shown)
Line 1:
{{short description|Series of virtual framebuffers used by computer graphics systems}}
{{Orphan|date=July 2010}}
 
{{Cleanup-jargon|date=November 2009}}
In [[computer graphics (computer science)|computer graphics]], a '''swap chain''' (also '''swapchain''') is a series of virtual [[framebuffer]]s utilizedused by the [[graphics card]] and graphics [[API]] for [[frame rate]] stabilization, stutter reduction, and several other functionspurposes. Because of these benefits, many graphics APIs require the use of a swap chain. The swap chain usually exists in [[Video card#Video memory|graphics memory]], but it can exist in system memory as well. The non-utilization of a swap chain will result in stuttering [[real Time rendering|rendering]], but its existence and utilization are required by many graphics APIs. A swap chain with two buffers is a [[doublekind buffer]], and one with three is aof [[tripledouble buffer]].
__NOTOC__
In [[computer graphics (computer science)|computer graphics]], a '''swap chain''' is a series of virtual [[framebuffer]]s utilized by the [[graphics card]] and graphics [[API]] for [[frame rate]] stabilization and several other functions. The swap chain usually exists in [[Video card#Video memory|graphics memory]], but it can exist in system memory as well. The non-utilization of a swap chain will result in stuttering [[real Time rendering|rendering]], but its existence and utilization are required by many graphics APIs. A swap chain with two buffers is a [[double buffer]], and one with three is a [[triple buffer]].
 
==Function==
[[File:swap chain depiction.svg|thumb|alt=Swap Chain|A graphical depiction of a triple-buffered swap chain.]]
In every swap chain there are at least two buffers. The first framebuffer, the screenbuffer, is the buffer that is [[Rendering (computer graphics)|rendered]] to the [[output]] of the [[video card]]. The remaining buffers are known as backbuffers. Each time a new [[Film frame|frame]] is displayed, the first back bufferbackbuffer in the swap chain takes the place of the screenbuffer, this is called ''presentation'' or ''swapping''. A variety of other actions may be taken on the previous screenbuffer and other backbuffers (if they exist). The screenbuffer may be simply [[Overwriting (Computer Science)|overwritten]] or returned to the back of the swap chain for further processing. The action taken is decided by the [[client (computing)|client]] application and is API dependent.
 
===Direct3D===
[[Microsoft]] [[Direct3D]] implements a SwapChain class. Each host device has at least one swap chain assigned to it, and others may be created by the client application.<ref name="msnd 0">
{{Citecite web
| title = SwapChain Class
| publisher = Microsoft
Line 16 ⟶ 15:
| accessdate = 30 October 2009
}}</ref> The API provides three methods of swapping: copy, discard, and flip. When the SwapChain is set to flip, the screenbuffer is copied onto the last backbuffer, then all the existing backbuffers are copied forward in the chain. When copy is set, each backbuffer is copied forward, but the screenbuffer is not wrapped to the last buffer, leaving it unchanged. Flip does not work when there is only one backbuffer, as the screenbuffer is copied over the only backbuffer before it can be presented. In discard mode, the driver selects the best method.<ref name="nexe 0">
{{Citecite web
| title = Swap Chains
| publisher = neXe
| url = http://nexe.gamedev.net/directKnowledge/default.asp?p=Swap%20Chains
| accessdate = 30 October 20092015-05-16
}}</ref>
 
==Comparison with triple buffering==
==Notes==
Outside the context of Direct3D, [[triple buffering]] refers to the technique of allowing an application to draw to whichever back buffer was least recently updated. This allows the application to always proceed with rendering, regardless of the pace at which frames are being drawn by the application or the pace at which frames are being sent to the display. Triple Buffering may result in a frame being discarded without being displayed if two or more newer frames are completely rendered in the time it takes for one frame to be sent to the display. By contrast, Direct3D swap chains are a strict [[Queue (abstract data type)|first-in, first-out queue]], so every frame that is drawn by the application will be displayed even if newer frames are available. Direct3D does not implement a most-recent buffer swapping strategy, and Microsoft's documentation calls a Direct3D swap chain of three buffers "triple buffering". Triple Buffering as described above is superior for interactive purposes such as gaming, but Direct3D swap chains of more than three buffers can be better for tasks such as presenting frames of a video where the time taken to [[Data compression#Video|decode]] each frame may be highly variable.<ref name="anandtech 0">
{{cite web
| title = Triple Buffering: Why We Love It
| publisher = AnandTech
| url = http://www.anandtech.com/show/2794/4
| archive-url = https://web.archive.org/web/20100407062123/http://www.anandtech.com/show/2794/4
| url-status = dead
| archive-date = April 7, 2010
| accessdate = 27 May 2014
}}</ref>
 
==References==
<references/>
 
 
[[Category:Computer graphics]]
 
 
{{Compu-graphics-stub}}