Share via


SwapChain.Present(Rectangle,Rectangle,IntPtr,Present) Method (Microsoft.DirectX.Direct3D)

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

Definition

Visual Basic Public Sub Present( _
    ByVal sourceRectangle As RectangleLeave Site, _
    ByVal destRectangle As RectangleLeave Site, _
    ByVal overrideWindowHandle As IntPtrLeave Site, _
    ByVal flags As Present _
)
C# public void Present(
    RectangleLeave Site sourceRectangle,
    RectangleLeave Site destRectangle,
    IntPtrLeave Site overrideWindowHandle,
    Present flags
);
C++ public:
void Present(
    RectangleLeave Site sourceRectangle,
    RectangleLeave Site destRectangle,
    IntPtrLeave Site overrideWindowHandle,
    Present flags
);
JScript public function Present(
    sourceRectangle : RectangleLeave Site,
    destRectangle : RectangleLeave Site,
    overrideWindowHandle : IntPtrLeave Site,
    flags : Present
);

Parameters

sourceRectangle System.Drawing.Rectangle
A RectangleLeave Site that contains the source rectangle. This value must be omitted unless the swap chain was created with Copy. If the value is omitted, the entire source surface is presented. If the rectangle exceeds the source surface, it is clipped to fit.
destRectangle System.Drawing.Rectangle
A RectangleLeave Site that contains the destination rectangle in window client coordinates. This value can be used only if the swap chain was created with SwapEffect.Copy. If the value is omitted, the entire client area is filled. If the rectangle exceeds the destination client area, it is clipped to fit.
overrideWindowHandle System.IntPtr
Destination window whose client area is taken as the target for the current presentation. If this parameter is omitted, the PresentParameters.DeviceWindowHandle member is used.
flags Microsoft.DirectX.Direct3D.Present
Allows the application to request that the method return immediately when the driver reports that it cannot schedule a presentation. Valid values are 0, Present.DoNotWait, Present.LinearContent or a combination of these values. See Remarks.

Remarks

If param_Present_flags = 0, Present spins without returning an error until the hardware is free.

If param_Present_flags = Present.DoNotWait and the hardware is busy processing or waiting for a vertical sync interval, the method throws a WasStillDrawingException.

If param_Present_flags = Present.LinearContent, gamma correction is performed from linear space to sRGB for windowed swap chains. This flag takes effect only when the Caps.DriverCaps.SupportsLinearToSrgbPresentation property is set to true.

The Device.Present method is a shortcut to SwapChain.Present. The swap chain method has been updated to include a flag that allows the application to request that the method return immediately when the driver reports that it cannot schedule a presentation.

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

The Device.Present method fails if it is called between a Device.BeginScene ... Device.EndScene pair, unless the render target is not the current render target (for example, the back buffer that results from the creation of an additional swap chain).

Exceptions

DriverInternalErrorException

Internal driver error. Applications should generally shut down when receiving this error.

DeviceLostException

The device is lost but cannot be reset at this time. Therefore, rendering is not possible.

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

OutOfVideoMemoryException

Microsoft Direct3D does not have enough display memory to perform the operation.

OutOfMemoryExceptionLeave Site

Direct3D could not allocate sufficient memory to complete the call.

See Also