IDXGISwapChain3

Interface

Represents a swap chain, which is a collection of surfaces that a Direct3D application uses to render frames.

This interface extends IDXGISwapChain2 by allowing you to manage multiple buffers and get the current buffer index.

Members

Member Description
GetBufferCount Gets the number of buffers in the swap chain.
GetBuffer Gets a back buffer from the swap chain.
Present Presents the next frame on the screen.
GetDesc Gets a description of the swap chain.
ResizeBuffers Resizes the back buffers.
SetFullscreenState Sets the full-screen state.
GetLastPresentCount Gets the count of present operations.
GetCurrentBufferIndex Gets the index of the buffer that is currently displayed.
SetSwapChainWindow Associates a window with the swap chain.
GetFullscreenDesc Gets the description of the swap chain when it is in full-screen mode.
ResizeBuffers1 Resizes the back buffer to a specified size.
SetSwapChainState Sets the swap chain state.
GetLastPresentCount2 Gets the count of present operations.
GetBuffer2 Gets a back buffer from the swap chain.
Present1 Presents the next frame on the screen.
SetSwapChainLayout Sets the swap chain layout.

Methods

GetCurrentBufferIndex

HRESULT GetCurrentBufferIndex(UINT* pBufferIndex);

Gets the index of the buffer that is currently displayed.

Parameters

  • pBufferIndex [out] - Pointer to a UINT variable that receives the index of the currently displayed buffer.

Return value

Returns S_OK on success, or an appropriate DXGI error code.

Note: This method is available starting with Windows 10.

GetBuffer2

HRESULT GetBuffer2(UINT Buffer, REFIID riid, _COM_Outptr_ void** ppSurface);

Gets a back buffer from the swap chain.

Parameters

  • Buffer [in] - The index of the buffer to get.
  • riid [in] - The globally unique identifier (GUID) for the interface type.
  • ppSurface [out] - The address of a pointer to the back buffer.

Return value

Returns S_OK on success, or an appropriate DXGI error code.

Present1

HRESULT Present1(UINT SyncInterval, UINT Flags, const DXGI_PRESENT_PARAMETERS* pPresentParameters);

Presents the next frame on the screen.

Parameters

  • SyncInterval [in] - For hardware-determined swap effects, the interval for VSync.
  • Flags [in] - Options for the presentation.
  • pPresentParameters [in] - Pointer to a DXGI_PRESENT_PARAMETERS structure that describes the presentation.

Return value

Returns S_OK on success, or an appropriate DXGI error code.

Tip: Use this method for more advanced presentation control compared to the inherited Present method.

Remarks

Use IDXGISwapChain3 to manage multiple rendering targets and control the presentation of frames with greater precision. The addition of GetCurrentBufferIndex is particularly useful for scenarios where you need to know which buffer is currently visible to the user.

This interface is typically obtained by calling IDXGIFactory::CreateSwapChainForHwnd, IDXGIFactory::CreateSwapChainForCoreWindow, or IDXGIFactory::CreateSwapChainForComposition and then querying for the IDXGISwapChain3 interface.

Requirements

Component Version
Minimum supported client Windows 10
Minimum supported server Windows Server 2016
Header dxgi.h
Library dxgi.lib
DLL dxgi.dll