IDirect3D8::CheckDeviceType

This method verifies whether a certain device type can be used on this adapter and expect hardware acceleration using the given formats.

HRESULT CheckDeviceType(
  UINT Adapter,
  D3DDEVTYPE CheckType,
  D3DFORMAT DisplayFormat,
  D3DFORMAT BackBufferFormat,
  BOOL Windowed
);

Parameters

  • Adapter
    [in] Ordinal number denoting the display adapter to enumerate. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns D3DERR_INVALIDCALL when this value equals or exceeds the number of display adapters in the system.
  • CheckType
    [in] Member of the D3DDEVTYPE enumerated type, indicating the device type to check.
  • DisplayFormat
    [in] Member of the D3DFORMAT enumerated type, indicating the format of the adapter display mode for which the device type is to be checked. For example, some devices will operate only in 16-bits-per-pixel modes.
  • BackBufferFormat
    [in] Member of the D3DFORMAT enumerated type, indicating the format of the back buffer to be tested
  • Windowed
    [in] Value indicating whether the device type will be used in full-screen or windowed mode. If set to TRUE, the query is performed for windowed applications; otherwise, this value should be set FALSE.

Return Values

If the device can be used on this adapter, D3D_OK is returned.

D3DERR_INVALIDCALL is returned if Adapter equals or exceeds the number of display adapters in the system. This method returns D3DERR_INVALIDDEVICE if CheckType specified a device that does not exist. D3DERR_NOTAVAILABLE is returned if either surface format is not supported, or if hardware acceleration is not available for the specified formats.

Remarks

The most important device type that may not be present is D3DDEVTYPE_HAL. D3DDEVTYPE_HAL requires hardware acceleration. Applications should use CheckDeviceType to determine if the needed hardware and drivers are present on the system. The other device that may not be present is D3DDEVTYPE_SW. This device type represents a pluggable software device that was registered using IDirect3D8::RegisterSoftwareDevice.

Applications should not specify a DisplayFormat that contains an alpha channel. This will result in a failed call. Note that an alpha channel may be present in the back buffer, but the two display formats must be identical in all other respects. For example, if DisplayFormat is D3DFMT_X1R5G5B5, valid values for BackBufferFormat include D3DFMT_X1R5G5B5 and D3DFMT_A1R5G5B5, but exclude D3DFMT_R5G6B5.

The following code fragment shows how you could use CheckDeviceType to test whether a certain device type can be used on this adapter.

if(SUCCEEDED(pD3Device->CheckDeviceType(D3DADAPTER_DEFAULT,
                                        D3DDEVTYPE_HAL, 
                                        DisplayFormat, 
                                        BackBufferFormat, 
                                        bIsWindowed)))
     return S_OK;

// There is no HAL on this adapter using this render target format. 
// Try again, using another format.

The preceding code will return S_OK if the device can be used on the default adapter, with the specified surface format.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: D3d8.h.
Link Library: D3d8.lib.

See Also

D3DDEVTYPE | D3DFORMAT | IDirect3D8::RegisterSoftwareDevice | IDirect3D8

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.