IDXGISwapChain::Present method (dxgi.h)

Presents a rendered image to the user.

Syntax

HRESULT Present(
  UINT SyncInterval,
  UINT Flags
);

Parameters

SyncInterval

Type: UINT

An integer that specifies how to synchronize presentation of a frame with the vertical blank.

For the bit-block transfer (bitblt) model (DXGI_SWAP_EFFECT_DISCARD or DXGI_SWAP_EFFECT_SEQUENTIAL), values are:

  • 0 - The presentation occurs immediately, there is no synchronization.
  • 1 through 4 - Synchronize presentation after the nth vertical blank.
For the flip model (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL), values are:
  • 0 - Cancel the remaining time on the previously presented frame and discard this frame if a newer frame is queued.
  • 1 through 4 - Synchronize presentation for at least n vertical blanks.
For an example that shows how sync-interval values affect a flip presentation queue, see Remarks.

If the update region straddles more than one output (each represented by IDXGIOutput), Present performs the synchronization to the output that contains the largest sub-rectangle of the target window's client area.

Flags

Type: UINT

An integer value that contains swap-chain presentation options. These options are defined by the DXGI_PRESENT constants.

Return value

Type: HRESULT

Possible return values include: S_OK, DXGI_ERROR_DEVICE_RESET or DXGI_ERROR_DEVICE_REMOVED (see DXGI_ERROR), DXGI_STATUS_OCCLUDED (see DXGI_STATUS), or D3DDDIERR_DEVICEREMOVED.

Note  The Present method can return either DXGI_ERROR_DEVICE_REMOVED or D3DDDIERR_DEVICEREMOVED if a video card has been physically removed from the computer, or a driver upgrade for the video card has occurred.
 

Remarks

Starting with Direct3D 11.1, consider using IDXGISwapChain1::Present1 because you can then use dirty rectangles and the scroll rectangle in the swap chain presentation and as such use less memory bandwidth and as a result less system power. For more info about using dirty rectangles and the scroll rectangle in swap chain presentation, see Using dirty rectangles and the scroll rectangle in swap chain presentation.

For the best performance when flipping swap-chain buffers in a full-screen application, see Full-Screen Application Performance Hints.

Because calling Present might cause the render thread to wait on the message-pump thread, be careful when calling this method in an application that uses multiple threads. For more details, see Multithreading Considerations.

Differences between Direct3D 9 and Direct3D 10:

Specifying DXGI_PRESENT_TEST in the Flags parameter is analogous to IDirect3DDevice9::TestCooperativeLevel in Direct3D 9.

For flip presentation model swap chains that you create with the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL or DXGI_SWAP_EFFECT_DISCARD value set, a successful presentation unbinds back buffer 0 (usually set by OMSetRenderTargets) from the graphics pipeline, except for when you pass the DXGI_PRESENT_DO_NOT_SEQUENCE flag in the Flags parameter.

For info about how data values change when you present content to the screen, see Converting data for the color space.

Flip presentation model queue

Suppose the following frames with sync-interval values are queued from oldest (A) to newest (E) before you call Present.

A: 3, B: 0, C: 0, D: 1, E: 0

When you call Present, the runtime shows frame A for only 1 vertical blank interval. The runtime terminates frame A early because of the sync interval 0 in frame B. Then the runtime shows frame D for 1 vertical blank interval, and then frame E until you submit a new presentation. The runtime discards frames B and C.

Variable refresh rate displays

It is a requirement of variable refresh rate displays that tearing is enabled. The CheckFeatureSupport method can be used to determine if this feature is available, and to set the required flags refer to the descriptions of DXGI_PRESENT_ALLOW_TEARING and DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING, and Variable refresh rate displays.

Requirements

Requirement Value
Target Platform Windows
Header dxgi.h
Library DXGI.lib

See also

IDXGISwapChain