Swap the swap chain's next buffer with the front buffer.

  CONST RECT* pSourceRect,
  CONST RECT* pDestRect,
  HWND hDestWindowOverride,
  CONST RGNDATA* pDirtyRegion,
  DWORD dwFlags


  • pSourceRect
    [in] Pointer to a value that must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. pSourceRect is a pointer to a RECT structure containing the source rectangle. If NULL, the entire source surface is presented. If the rectangle exceeds the source surface, the rectangle is clipped to the source surface.
  • pDestRect
    [in] Pointer to a value that must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. pDestRect is a pointer to a RECT structure containing the destination rectangle, in window client coordinates. If NULL, the entire client area is filled. If the rectangle exceeds the destination client area, the rectangle is clipped to the destination client area.
  • hDestWindowOverride
    [in] Pointer to a destination window whose client area is taken as the target for this presentation. If this value is NULL, then the hWndDeviceWindow member of D3DPRESENT_PARAMETERS is taken.
  • pDirtyRegion
    [in] Value must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. For more information about swap chains, see Flipping Surfaces and D3DSWAPEFFECT. If this value is non-NULL, the contained region is expressed in back buffer coordinates. The rectangles within the region are the minimal set of pixels that need to be updated. This method takes these rectangles into account when optimizing the presentation by copying only the pixels within the region, or some suitably expanded set of rectangles. This is an aid to optimization only, and the application should not rely on the region being copied exactly. The implementation can choose to copy the whole source rectangle.
  • dwFlags
    [in] Allows the application to request that the method return immediately when the driver reports that it cannot schedule a presentation. Valid values are 0, or any combination of D3DPRESENT_DONOTWAIT D3DPRESENT_LINEAR_CONTENT or D3DPRESENT_DONOTFLIP (see D3DPRESENT).
    • If dwFlags = 0, this method behaves as it did prior to Microsoft Direct3D 9. Present will spin until the hardware is free, without returning an error.
    • If dwFlags = D3DPRESENT_DONOTWAIT, and the hardware is busy processing or waiting for a vertical sync interval, the method will return D3DERR_WASSTILLDRAWING.
    • If dwFlags = D3DPRESENT_LINEAR_CONTENT, gamma correction is performed from linear space to sRGB for windowed swap chains. This flag will take effect only when the driver exposes D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION (see Gamma).
    • If dwFlags = D3DPRESENT_DONOTFLIP the display driver is called with the front buffer as both the source and target surface. The driver responds by scheduling a frame synch, but not changing the displayed surface. This flag is only available in fullscreen mode.

Return Values

S_OK the device is ok for rendering.

S_PRESENT_MODE_CHANGED the display mode has changed.

S_PRESENT_OCCLUDED the window is occluded.

D3DERR_DEVICELOST the device has been lost.

D3DERR_DEVICEHUNG if the device is hung.

D3DERR_DEVICEREMOVED if the device has been removed.

See Device State Return Codes for more information about these Return codes. See Lost Device Behavior Changes for more information about lost, hung, and removed devices.


Similar to the IDirect3DDevice9::Present Method, PresentEx adds a dwflags parameter.

See Also

IDirect3DDevice9Ex Interface