Device State Return Codes 

Device State Return Codes

The following codes correspond to the state of the device. Several methods return these to report device state including IDirect3DDevice9Ex::CheckDeviceState, IDirect3DDevice9Ex::PresentEx and IDirect3DDevice9Ex::ResetEx.

Return Codes

D3DERR_DEVICELOST

A Direct 3D device object other than the one that returned this code caused the hardware adapter to be reset by the OS. Delete all video memory objects (surfaces, textures, state blocks) and call Reset() to return the device to a default state. If the application continues rendering without a reset, the rendering calls will succeed.

D3DERR_DEVICEHUNG

The device that returned this code caused the hardware adapter to be reset by the OS. Most applications should destroy the device and quit. Applications that must continue should destroy all video memory objects (surfaces, textures, state blocks etc) and call Reset() to put the device in a default state. If the application then continues rendering in the same way, the device will return to this state.

D3DERR_DEVICEREMOVED

The hardware adapter has been removed. Application must destroy the device, do enumeration of adapters and create another D3D device. If application continues rendering without calling Reset, the rendering calls will succeed.

S_OK

The device is running normally and can be used for rendering.

S_PRESENT_OCCLUDED

The presentation area is occluded. Occlusion means that the presentation window is minimized or another device entered the fullscreen mode on the same monitor as the presentation window and the presentation window is completely on that monitor. Occlusion will not occur if the client area is covered by another Window.

Occluded applications can continue rendering and all calls will succeed, but the occluded presentation window will not be updated. Preferably the application should stop rendering to the presentation window using the device and keep calling IDirect3DDevice9Ex::CheckDeviceState until S_OK or S_PRESENT_MODE_CHANGED returns.

S_PRESENT_MODE_CHANGED

The desktop display mode has been changed. The application can continue rendering, but there might be color conversion/stretching. Pick a back buffer format similar to the current display mode, and call Reset to recreate the swap chains. The device will leave this state after a Reset is called.