Microsoft DirectX 8.0 (Visual Basic)

Responding to a Lost Device

If a device is lost, the application queries the device to see if it can be restored to the operational state. If not, the application waits until the device can be restored.

If the device can be restored, the application prepares the device by destroying all video-memory resources and any swap chains. Then, the application calls Direct3DDevice8.Reset. Reset is the only method that has an effect when the device is lost, and is the only method by which an application can change the device from a lost to an operational state. Reset will fail unless the application releases all resources that are allocated in D3DPOOL_DEFAULT, including those created by the Direct3DDevice8.CreateRenderTarget and Direct3DDevice8.CreateDepthStencilSurface methods.

For the most part, the high-frequency calls of Microsoft® Direct3D® do not return information about whether the device has been lost. The application can continue to call rendering methods, such as Direct3DDevice8.DrawPrimitive, without receiving notification of a lost device. Internally, these operations are discarded until the device is reset to the operational state.

The application can determine what to do on encountering a lost device by querying the return value of the Direct3DDevice8.TestCooperativeLevel method.

In all cases, destroying video-memory resources is a prerequisite to calling Reset, even if the device has not been lost.