Manager.CheckDeviceType Method ()
Specifies whether a hardware-accelerated device type can be used on the current adapter.
Overload List
public static bool CheckDeviceType(int, DeviceType, Format, Format, bool); public static bool CheckDeviceType(int, DeviceType, Format, Format, bool, out int);
Remarks
A hardware abstraction layer (HAL) device type requires hardware acceleration. Applications can use Manager.CheckDeviceType to determine whether the hardware and drivers necessary to support a HAL device are present.
Full-screen applications should not specify a displayFormat that contains an alpha channel; doing so will result in a failed call. Note that an alpha channel can be present in the back buffer, but the two display formats must be identical in all other respects. For example, if displayFormat = Format.X1R5G5B5, valid values for backBufferFormat include Format.X1R5G5B5 and Format.A1R5G5B5 but exclude Format.R5G6B5.
The following C# code fragment demonstrates the use of CheckDeviceType to determine whether a certain device type can be used on the adapter.
[C#] public void Test_Manager_CheckDeviceType() { int result; // Test some formats IsDeviceTypeOK(Format.X8R8G8B8, Format.A8R8G8B8, out result); if (result != (int)ResultCode.Success) System.Windows.Forms.MessageBox.Show(String.Format("The device check failed: {0}", result)); } public bool IsDeviceTypeOK (Format displayFmt, Format backbufferFmt, out int result) { AdapterInformation ai = Manager.Adapters.Default; // Verify that the device can be used on the default adapter with the given surface format if (Manager.CheckDeviceType(ai.Adapter, DeviceType.Hardware, displayFmt, backbufferFmt, false, out result)) { return true; // if the call succeeds } return false; // otherwise fail. NOTE: HRESULT passed back in result }
The preceding code returns true if the device can be used on the default adapter with the specified surface format.
Using Manager.CheckDeviceType to test for compatibility between a back buffer that differs from 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, result is still set to ResultCode.NotAvailable. If the device can render to the format but cannot perform the color-converting presentation, result is also set to 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.