IDirect3DDevice9Ex::PresentEx method (d3d9.h)
Swap the swapchain's next buffer with the front buffer.
Syntax
HRESULT PresentEx(
[in] const RECT *pSourceRect,
[in] const RECT *pDestRect,
[in] HWND hDestWindowOverride,
[in] const RGNDATA *pDirtyRegion,
[in] DWORD dwFlags
);
Parameters
[in] pSourceRect
Type: const RECT*
Pointer to a RECT structure indicating region on the source surface to copy in window client coordinates. Only applies when the swapchain was created with the D3DSWAPEFFECT_COPY flag. If NULL, the entire source surface is presented. If the rectangle exceeds the source surface, it is clipped to the source surface.
[in] pDestRect
Type: const RECT*
Pointer to RECT structure indicating the target region on the destination surface in window client coordinates. Only applies when the swapchain was created with the D3DSWAPEFFECT_COPY flag. If NULL, the entire client area is filled. If the rectangle exceeds the destination client area, it is clipped to the destination client area.
[in] hDestWindowOverride
Type: HWND
Pointer to a destination window whose client area is taken as the target for this presentation. If this value is NULL, the runtime uses the hDeviceWindow member of D3DPRESENT_PARAMETERS for the presentation.
[in] pDirtyRegion
Type: const RGNDATA*
Pointer to a RGNDATA structure indicating the smallest set of pixels that need to be transferred. This value must be NULL unless the swapchain was created with the D3DSWAPEFFECT_COPY flag. For more information about swapchains, see Flipping Surfaces (Direct3D 9).
If this value is non-NULL, the contained region is expressed in back buffer coordinates. The 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.
[in] dwFlags
Type: DWORD
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 flags.
- If dwFlags = 0, this method behaves as it did prior to Direct3D 9. Present will spin until the hardware is free, without returning an error.
- 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 full-screen mode or when using D3DSWAPEFFECT_FLIPEX in windowed mode.
- 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_FORCEIMMEDIATE, D3DPRESENT_INTERVAL_IMMEDIATE is enforced on this Present call. This flag can only be specified when using D3DSWAPEFFECT_FLIPEX. This behavior is the same for windowed and full-screen modes.
- 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 (Direct3D 9)).
Return value
Type: HRESULT
Possible return values include: S_OK, D3DERR_DEVICELOST, D3DERR_DEVICEHUNG, D3DERR_DEVICEREMOVED, or D3DERR_OUTOFVIDEOMEMORY (see D3DERR). See Lost Device Behavior Changes for more information about lost, hung, and removed devices.
Differences between Direct3D 9 and Direct3D 9Ex:
D3DSWAPEFFECT_FLIPEX is only available in Direct3D9Ex running on Windows 7 (or more current operating system). |
Remarks
Similar to the IDirect3DDevice9::Present Method, PresentEx adds a dwflags parameter.
When the swapchain is created with D3DSWAPEFFECT_FLIPEX flag, pSourceRect, pDestRect and pDirtyRegion values must be set to NULL.
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | d3d9.h |
Library | D3D9.lib |