Platform SDK: DirectX

Testing Hardware Acceleration Levels

Some applications may need to test a particular device for different hardware acceleration levels.

DescribeDevice( DWORD index )
{
    D3DX_DEVICEDESC devDesc;
 
    hr = D3DXGetDeviceDescription( index, &devDesc );
 
    if (D3DX_HWLEVEL_2D == devDesc.hwLevel)
    {
        // do something
    }
    else if (D3DX_HWLEVEL_RASTER == devDesc.hwLevel)
    {
        // do something
    }
    else if (D3DX_HWLEVEL_REFERENCE == devDesc.hwLevel)
    {
        // do something
    }
    else if (D3DX_HWLEVEL_TL == devDesc.hwLevel)
    {
        // do something
    }
    else    // D3DX_DEFAULT == devDesc.hwLevel
        // do something

The preceding code fragment uses the index of a device to look for the hardware acceleration flag that describes that device.