IDXGISwapChain Interface
The IDXGISwapChain interface represents a swap chain, which is a collection of buffers that a DirectX Graphics Infrastructure (DXGI) device uses to present rendered images to an application.
Interface Members
Methods
The IDXGISwapChain interface inherits from IDXGIDevice.
Method | Description |
---|---|
GetBuffer | Gets a buffer from the swap chain. |
GetDesc | Gets a description of the swap chain. |
GetDesc1 | Gets a description of the swap chain (DXGI 1.2). |
GetFrameStatistics | Gets frame statistics. |
GetLastPresentCount | Gets the count of present operations. |
Present | Presents the next frame to the user. |
ResizeBuffers | Resizes the back buffer of the swap chain. |
ResizeTarget | Resizes the target rectangle of the swap chain. |
ScrollWindow | (Deprecated) Scrolls the back buffer. |
Remarks
A swap chain is a set of Direct3D surface buffers that are used to represent the content that you are rendering. When you render to a surface in a swap chain, you are rendering to one of the buffers in the chain. When you are finished rendering, you call the Present method to display the rendered buffer.
Requirements
Header: dxgi.h
Library: dxgi.lib
Minimum supported client: Windows 7 with Direct3D 10
Minimum supported server: Windows Server 2008 R2 with Direct3D 10
Product: DirectX Graphics Infrastructure (DXGI)
GetBuffer
Retrieves a buffer from the swap chain.
HRESULT GetBuffer(
UINT Buffer,
REFIID riid,
void **ppSurface
);
Parameters
Name | Type | Description |
---|---|---|
Buffer |
UINT |
A zero-based index for the buffer that you want to retrieve. |
riid |
REFIID |
The globally unique identifier (GUID) for the buffer interface (e.g., __uuidof(ID3D11Texture2D) ). |
ppSurface |
void ** |
The address of a pointer to the buffer interface. |
Return value
Returns S_OK on success; otherwise, returns one of the DXGI error codes.
GetDesc
Gets a description of the swap chain.
HRESULT GetDesc(
DXGI_SWAP_CHAIN_DESC *pDesc
);
Parameters
Name | Type | Description |
---|---|---|
pDesc |
DXGI_SWAP_CHAIN_DESC * |
A pointer to a DXGI_SWAP_CHAIN_DESC structure that describes the swap chain. |
Return value
Returns S_OK on success; otherwise, returns one of the DXGI error codes.
GetDesc1
Gets a description of the swap chain (DXGI 1.2).
HRESULT GetDesc1(
DXGI_SWAP_CHAIN_DESC1 *pDesc
);
Parameters
Name | Type | Description |
---|---|---|
pDesc |
DXGI_SWAP_CHAIN_DESC1 * |
A pointer to a DXGI_SWAP_CHAIN_DESC1 structure that describes the swap chain. |
Return value
Returns S_OK on success; otherwise, returns one of the DXGI error codes.
Present
Presents the next frame to the user.
HRESULT Present(
UINT SyncInterval,
UINT Flags
);
Parameters
Name | Type | Description |
---|---|---|
SyncInterval |
UINT |
The time interval for V-Sync. 0 means to skip V-Sync; 1 means to wait for V-Sync. |
Flags |
UINT |
Flags that control presentation. See DXGI_PRESENT flags. |
Return value
Returns S_OK on success; otherwise, returns one of the DXGI error codes.
ResizeBuffers
Resizes the back buffer of the swap chain.
HRESULT ResizeBuffers(
UINT BufferCount,
UINT Width,
UINT Height,
DXGI_FORMAT NewFormat,
UINT SwapChainFlags
);
Parameters
Name | Type | Description |
---|---|---|
BufferCount |
UINT |
The number of buffers in the swap chain. |
Width |
UINT |
The width of the new back buffer. |
Height |
UINT |
The height of the new back buffer. |
NewFormat |
DXGI_FORMAT |
The new format of the back buffer. |
SwapChainFlags |
UINT |
Flags that control the swap chain. |
Return value
Returns S_OK on success; otherwise, returns one of the DXGI error codes.