Device.Reset Method

Language:

Resets the presentation parameters for the current device.

Definition

Visual Basic Public Sub Reset( _
    ByVal presentationParameters() As PresentParameters _
)
C# public void Reset(
    PresentParameters[] presentationParameters
);
C++ public:
void Reset(
    array<PresentParameters^>^ presentationParameters
);
JScript public function Reset(
    presentationParameters : PresentParameters[]
);

Parameters

presentationParameters Microsoft.DirectX.Direct3D.PresentParameters[]
[in, out] A PresentParameters structure that describes the new presentation parameters. This value cannot be null.

Remarks

When switching to full-screen mode, Microsoft Direct3D tries to find a desktop format that matches the back buffer format, so that back and front buffer formats are identical. This eliminates the need for color conversion.

If a call to Device.Reset fails, the device is placed in the "lost" state (as indicated by a return value of false from a call to CheckCooperativeLevel) unless it is already in the "not reset" state (as indicated by a ResultCode.DeviceNotReset returned from the param_Int32R_result parameter of the Device.CheckCooperativeLevel method). For more information about the use of Reset in the context of lost devices, see CheckCooperativeLevel.

Calling Device.Reset causes all texture memory surfaces and state information to be lost, and managed textures to be flushed from video memory. Before calling Device.Reset for a device, an application should release any explicit render targets, depth stencil surfaces, additional swap chains, state blocks, and Default resources associated with the device.

Swap chains are either full-screen or windowed. If the new swap chain is full-screen, the adapter is placed in the display mode that matches the new size.

Microsoft DirectX 9.0 applications can expect messages to be sent to them during this call (for example, before the call is returned); applications should take precautions not to call into Direct3D at this time. In addition, when Device.Reset fails, the only valid methods that can be called are Device.Reset, Device.CheckCooperativeLevel, Device.TestCooperativeLevel, and the various Release member functions. Calling any other method can result in an exception.

A call to Device.Reset fails if made on a different thread than the one used to create the device being reset.

Pixel shaders and vertex shaders survive Device.Reset calls for DirectX 9.0. They do not need to be re-created explicitly by the application.

Unknown can be specified for the windowed mode back buffer format when calling Device.Device, Device.Reset, and SwapChain. This means the application does not have to query the current desktop format before calling Device.Device for windowed mode. For full-screen mode, the back buffer format must be specified. Setting PresentParameters.BackBufferCount = 0 results in the creation of one back buffer.

When trying to reset more than one display adapter in a group, pass in an array of PresentParameters objects, one for each display in the adapter group.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
DeviceLostException The device is lost but cannot be reset at this time. Therefore, rendering is not possible.
DriverInternalErrorException Internal driver error. Applications should generally shut down when receiving this error.
OutOfVideoMemoryException Direct3D does not have enough display memory to perform the operation.
OutOfMemoryException Leave Site Direct3D could not allocate sufficient memory to complete the call.

See Also


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center