IDXGISwapChain3::ResizeBuffers1 method

Changes the swap chain's back buffer size, format, and number of buffers, where the swap chain was created using a D3D12 command queue as an input device. This should be called when the application window is resized.

Syntax

HRESULT ResizeBuffers1(
  UINT        BufferCount,
  UINT        Width,
  UINT        Height,
  DXGI_FORMAT Format,
  UINT        SwapChainFlags,
  const UINT  *pCreationNodeMask,
  IUnknown    * const *ppPresentQueue
);

Parameters

BufferCount

Type: UINT

The number of buffers in the swap chain (including all back and front buffers). This number can be different from the number of buffers with which you created the swap chain. This number can't be greater than DXGI_MAX_SWAP_CHAIN_BUFFERS. Set this number to zero to preserve the existing number of buffers in the swap chain. You can't specify less than two buffers for the flip presentation model.

Width

Type: UINT

The new width of the back buffer. If you specify zero, DXGI will use the width of the client area of the target window. You can't specify the width as zero if you called the IDXGIFactory2::CreateSwapChainForComposition method to create the swap chain for a composition surface.

Height

Type: UINT

The new height of the back buffer. If you specify zero, DXGI will use the height of the client area of the target window. You can't specify the height as zero if you called the IDXGIFactory2::CreateSwapChainForComposition method to create the swap chain for a composition surface.

Format

Type: DXGI_FORMAT

A DXGI_FORMAT-typed value for the new format of the back buffer. Set this value to DXGI_FORMAT_UNKNOWN to preserve the existing format of the back buffer. The flip presentation model supports a more restricted set of formats than the bit-block transfer (bitblt) model.

SwapChainFlags

Type: UINT

A combination of DXGI_SWAP_CHAIN_FLAG-typed values that are combined by using a bitwise OR operation. The resulting value specifies options for swap-chain behavior.

pCreationNodeMask

Type: const UINT*

An array of UINTs, of total size BufferCount, where the value indicates which node the back buffer should be created on. Buffers created using ResizeBuffers1 with a non-null pCreationNodeMask array are visible to all nodes.

ppPresentQueue

Type: IUnknown*

An array of command queues (ID3D12CommandQueue instances), of total size BufferCount. Each queue provided must match the corresponding creation node mask specified in the pCreationNodeMask array. When Present() is called, in addition to rotating to the next buffer for the next frame, the swapchain will also rotate through these command queues. This allows the app to control which queue requires synchronization for a given present operation.

Return value

Type: HRESULT

Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.

Remarks

This method is only valid to call when the swapchain was created using a D3D12 command queue (ID3D12CommandQueue) as an input device.

When a swapchain is created on a multi-GPU adapter, the backbuffers are all created on node 1 and only a single command queue is supported. ResizeBuffers1 enables applications to create backbuffers on different nodes, allowing a different command queue to be used with each node. These capabilities enable Alternate Frame Rendering (AFR) techniques to be used with the swapchain. See Multi-adapter systems.

The only difference between IDXGISwapChain::ResizeBuffers in Windows 8 versus Windows 7 is with flip presentation model swap chains that you create with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_DISCARD value set. In Windows 8, you must call ResizeBuffers to realize a transition between full-screen mode and windowed mode; otherwise, your next call to the IDXGISwapChain::Present method fails.

Also see the Remarks section in IDXGISwapChain::ResizeBuffers, all of which is relevant to ResizeBuffers1.

Requirements

   
Target Platform Windows
Header dxgi1_4.h
Library Dxgi.lib

See also

IDXGISwapChain3