?/TD>
Microsoft DirectX 9.0

IDirect3DDevice9::Reset Method


Resets the type, size, and format of the swap chain.

Syntax

HRESULT Reset(      

    D3DPRESENT_PARAMETERS* pPresentationParameters );

Parameters

pPresentationParameters
[in, out] Pointer to a D3DPRESENT_PARAMETERS structure, describing the new presentation parameters. This value cannot be NULL.

When switching to full-screen mode, Microsoft?Direct3D?will try to find a desktop format that matches the back buffer format, so that back buffer and front buffer formats will be identical (to eliminate the need for color conversion).

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_DEVICELOSTThe device has been lost but cannot be reset at this time. Therefore, rendering is not possible.
D3DERR_DRIVERINTERNALERROR

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

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
D3DERR_OUTOFVIDEOMEMORYDirect3D does not have enough display memory to perform the operation.
E_OUTOFMEMORYDirect3D could not allocate sufficient memory to complete the call.


Remarks

If a call to IDirect3DDevice9::Reset fails, the device will be placed in the "lost" state (as indicated by a return value of D3DERR_DEVICELOST from a call to IDirect3DDevice9::TestCooperativeLevel) unless it is already in the "not reset" state (as indicated by a return value of D3DERR_DEVICENOTRESET from a call to IDirect3DDevice9::TestCooperativeLevel). Refer to IDirect3DDevice9::TestCooperativeLevel and Lost Devices for further information concerning the use of IDirect3DDevice9::Reset in the context of lost devices.

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

The different types of swap chains are full-screen or windowed. If the new swap chain is full-screen, the adapter will be 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 this call is returned); applications should take precautions not to call into Direct3D at this time. In addition, when IDirect3DDevice9::Reset fails, the only valid methods that can be called are IDirect3DDevice9::Reset, IDirect3DDevice9::TestCooperativeLevel, and the various Release member functions. Calling any other method can result in an exception.

A call to IDirect3DDevice9::Reset will fail if called on a different thread than that used to create the device being reset.

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

D3DFMT_UNKNOWN can be specified for the windowed mode back buffer format when calling IDirect3D9::CreateDevice, IDirect3DDevice9::Reset and IDirect3DDevice9::CreateAdditionalSwapChain. This means the application does not have to query the current desktop format before calling IDirect3D9::CreateDevice for windowed mode. For full-screen mode, the back buffer format must be specified. Setting BackBufferCount = 0 results in one back buffer.

See Also

D3DSWAPEFFECT, D3DPRESENT_PARAMETERS, IDirect3DDevice9::Present, Multihead


© 2002 Microsoft Corporation. All rights reserved.