ID2D1Device::IsSupported method

[This documentation is preliminary and is subject to change.]

Applies to: desktop apps | Metro style apps

Indicates whether the supplied device capabilities are supported by the Direct2D device.

Syntax

BOOL IsSupported(
  [in]  const D2D1_DEVICE_PROPERTIES *deviceCapabilities
);

Parameters

  • deviceCapabilities [in]
    The device capabilities to be tested.

Return value

If the function succeeds, it returns TRUE. Otherwise, returns FALSE.

Remarks

This method is similar to the ID2D1RenderTarget::IsSupported method except that it allows Direct2D to return information about rendering support that isn't fully encapsulated at the Microsoft Direct3D feature level. If the underlying device doesn't meet all of the capabilities in the deviceCapabilities structure, the method will return FALSE.

The follow example code will return S_OK if the passed-in device supports 16f precision for Direct2D rendering, S_FALSE if it does not support it, or a failure.

HRESULT CheckForSoftwareFallback(
    ID2D1Factory *pD2D1Factory,
    ID3D11Device *pD3D11Device
    )
{
    HRESULT hr = S_OK;

    IDXGIDevice *pDXGIDevice = NULL;
    hr = pD3D11Device->QueryInterface(&pDXGIDevice);

    ID2D1Device *pD2D1Device = NULL;

    if (SUCCEEDED(hr))
    {
        hr = pD2D1Factory->CreateDevice(pDXGIDevice, &pD2D1Device);
    }

    if (SUCCEEDED(hr))
    {
        D2D1_DEVICE_PROPERTIES deviceProperties = {};

        // We need at least 16f precision, but not compute support
        deviceProperties.bufferPrecision = D2D1_BUFFER_PRECISION_16BPC_FLOAT;

        hr = pD2D1Device->IsSupported(&deviceProperties) ? S_OK : S_FALSE;
    }

    SafeRelease(&pDGXIDevice);
    SafeRelease(&pD2D1Device);

    return hr;
}

See D2D1_DEVICE_PROPERTIES for the properties that can be queried.

Requirements

Minimum supported client

Windows 8 Consumer Preview

Minimum supported server

Windows Server 8 Beta

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1Device

D2D1_DEVICE_PROPERTIES

ID2D1RenderTarget::IsSupported

 

 

Build date: 2/14/2012