?/TD>
Microsoft DirectX 9.0

IDirect3DDevice9::Present Method


Presents the contents of the next buffer in the sequence of back buffers owned by the device.

Syntax

HRESULT Present(      

    CONST RECT *pSourceRect,     CONST RECT *pDestRect,     HWND hDestWindowOverride,     CONST RGNDATA *pDirtyRegion );

Parameters

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.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be one of the following values.

D3DERR_DRIVERINTERNALERROR

Internal driver error. Applications should generally shut down when receiving this error. For more information, see Driver Internal Errors.

D3DERR_DEVICELOSTThe device has been lost but cannot be reset at this time. Therefore, rendering is not possible.
D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


Remarks

If necessary, a stretch operation is applied to transfer the pixels within the source rectangle to the destination rectangle in the client area of the target window.

Present will fail, returning D3DERR_INVALIDCALL, if called between BeginScene and EndScene pairs unless the render target is not the current render target (such as the back buffer you get from creating an additional swap chain). This is a new behavior for Microsoft?DirectX?9.0.

See Also

IDirect3DDevice9::Reset


© 2002 Microsoft Corporation. All rights reserved.