Manager.CheckDeviceFormatConversion(Int32,DeviceType,Format,Format) Method (Microsoft.DirectX.Direct3D)

Tests a device to determine whether it supports conversion from one display format to another.

Definition

Visual Basic Public Shared Function CheckDeviceFormatConversion( _
    ByVal adapter As Integer, _
    ByVal deviceType As DeviceType, _
    ByVal sourceFormat As Format, _
    ByVal targetFormat As Format _
) As Boolean
C# public static bool CheckDeviceFormatConversion(
    int adapter,
    DeviceType deviceType,
    Format sourceFormat,
    Format targetFormat
);
C++ public:
static bool CheckDeviceFormatConversion(
    int adapter,
    DeviceType deviceType,
    Format sourceFormat,
    Format targetFormat
);
JScript public static function CheckDeviceFormatConversion(
    adapter : int,
    deviceType : DeviceType,
    sourceFormat : Format,
    targetFormat : Format
) : boolean;

Parameters

adapter System.Int32
Display adapter ordinal number. AdapterListCollection.Default is always the primary display adapter. This method returns ResultCode.InvalidCall when the value equals or exceeds the number of display adapters in the system.
deviceType Microsoft.DirectX.Direct3D.DeviceType
Device type. Member of the DeviceType enumeration.
sourceFormat Microsoft.DirectX.Direct3D.Format
Source adapter format. Member of the Format enumeration.
targetFormat Microsoft.DirectX.Direct3D.Format
Target adapter format. Member of the Format enumeration.

Return Value

System.Boolean
Returns true if the method succeeds; false if it fails. Check the result parameter for the HRESULT code returned.

If the method fails, result is set to ResultCode.InvalidCall.

If the hardware does not support conversion between the two formats, result is set to ResultCode.NotAvailable.

Remarks

Using Manager.CheckDeviceType to test for compatibility between a back buffer and the display format returns appropriate values. This means that the call reflects device capabilities. If the device cannot render to the requested back buffer format, the call still returns ResultCode.NotAvailable. If the device can render to the format but cannot perform the color-converting presentation, the return value is also ResultCode.NotAvailable. Applications can discover hardware support for the presentation itself by calling Manager.CheckDeviceFormatConversion. No software emulation for the color-converting presentation itself is offered.

Manager.CheckDeviceFormatConversion also can be used to determine which combinations of source surface formats and destination surface formats are permissible in calls to Device.StretchRectangle.

Color conversion is restricted to the following source and target formats.

  • Source format must be a four-character code (FOURCC) format or a valid back buffer format. For a list of these, see FOURCC Formats and BackBuffer or Display Formats.

  • Target format must be one of the following unsigned formats. For more information, see Unsigned Formats.

    X1R5G5B5 A1R5G5B5 R5G6B5
    R8G8B8 X8R8G8B8 A8R8G8B8
    A2R10G10B10 A16B16G16R16 A2B10G10R10
    A8B8G8R8 X8B8G8R8 A16B16G16R16F
    A32B32G32R32F

See Also