Manager.CheckDeviceFormat(Int32,DeviceType,Format,Usage,ResourceType,Format) Method (Microsoft.DirectX.Direct3D)

How Do I...?

  • Check For HDR Texture Support

Determines whether a surface format is available as a specified resource type and can be used as a texture, depth stencil buffer, render target, or any combination of the three, on a device representing the current adapter.

Definition

Visual Basic Public Shared Function CheckDeviceFormat( _
    ByVal adapter As Integer, _
    ByVal deviceType As DeviceType, _
    ByVal adapterFormat As Format, _
    ByVal usage As Usage, _
    ByVal resourceType As ResourceType, _
    ByVal checkFormat As Format _
) As Boolean
C# public static bool CheckDeviceFormat(
    int adapter,
    DeviceType deviceType,
    Format adapterFormat,
    Usage usage,
    ResourceType resourceType,
    Format checkFormat
);
C++ public:
static bool CheckDeviceFormat(
    int adapter,
    DeviceType deviceType,
    Format adapterFormat,
    Usage usage,
    ResourceType resourceType,
    Format checkFormat
);
JScript public static function CheckDeviceFormat(
    adapter : int,
    deviceType : DeviceType,
    adapterFormat : Format,
    usage : Usage,
    resourceType : ResourceType,
    checkFormat : Format
) : boolean;

Parameters

adapter System.Int32
Ordinal number that denotes the display adapter to query. AdapterListCollection.Default is always the primary display adapter. This method returns ResultCode.InvalidCall if this value equals or exceeds the number of display adapters in the system.
deviceType Microsoft.DirectX.Direct3D.DeviceType
Member of the DeviceType enumeration that identifies the device type.
adapterFormat Microsoft.DirectX.Direct3D.Format
Member of the Format enumeration that identifies the format of the display mode into which the adapter will be placed.
usage Microsoft.DirectX.Direct3D.Usage
Requested usage options for the surface. Usage options are any combination of Usage enumeration values (only a subset of the Usage values are valid for CheckDeviceFormat). For more information, see Usage.
resourceType Microsoft.DirectX.Direct3D.ResourceType
A ResourceType requested for use with the queried format.
checkFormat Microsoft.DirectX.Direct3D.Format
Member of the Format enumeration that identifies the format of the surfaces that can be used, as defined by usage.

Return Value

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

If the format is not acceptable to the device for this usage, result is set to ResultCode.NotAvailable.

If adapter equals or exceeds the number of display adapters in the system, result is set to ResultCode.InvalidCall.

How Do I...?

Check For HDR Texture Support

This example demonstrates how to check a device to determine whether a specific texture format is supported.

In the following C# code example, device is assumed to be the rendering Device, and the adapterFormat variable is assumed to be a valid member of the Format enum.

              [C#]
              
// check support for a Format.A16B16R16F render target
if (!Manager.CheckDeviceFormat(0, DeviceType.Hardware, adapterFormat,
                                  Usage.RenderTarget, ResourceType.CubeTexture,
                                  Format.A16B16G16R16F))
    return true;
else
    return false;