Microsoft DirectX 8.1 (Visual Basic) |
Verifies whether or not a certain device type can be used on this adapter and expect hardware acceleration using the given formats.
object.CheckDeviceType( _ Adapter As Long, _ CheckType As CONST_D3DDEVTYPE, _ DisplayFormat As CONST_D3DFORMAT, _ BackBufferFormat As CONST_D3DFORMAT, _ bWindowed As Long) As Long
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.
Err.Number is not set for this method.
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..
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 checks to see if the default adapter will handle RGB565 colors in windowed mode using hardware acceleration.
Dim DisplayFormat As CONST_D3DFORMAT, BackBufferFormat As CONST_D3DFORMAT Dim IsWindowed As Long, bModeOK As Boolean, Check As Long DisplayFormat = D3DFMT_R5G6B5 BackBufferFormat = D3DFMT_R5G6B5 IsWindowed = 1 'True Check = d3d.CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayFormat, BackBufferFormat, IsWindowed) If (Check >= 0) Then bModeOK = 1 Else bModeOK = 0 End If