Share via


GraphicsAdapter.CheckDeviceType Method

Determines whether a hardware-accelerated device type can be used on the current adapter.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public bool CheckDeviceType (
         DeviceType deviceType,
         SurfaceFormat displayFormat,
         SurfaceFormat backBufferFormat,
         bool isFullScreen
)

Parameters

  • deviceType
    The type of device to check.

  • displayFormat
    The format of the adapter display mode for which the device type is being checked. For example, some devices operate only in modes of 16 bits per pixel.

  • backBufferFormat
    Format of the back buffer. This value must be one of the render target formats. DisplayMode can be used to obtain the current format.

    For windowed applications, the back-buffer format does not need to match the display-mode format if the hardware supports color conversion. The set of possible back-buffer formats is constrained, but the runtime allows any valid back-buffer format to be presented to any desktop format. Additionally, the device must be operable in desktop mode because devices typically do not operate in modes of 8 bits per pixel.

    Full-screen applications cannot perform color conversion.

    SurfaceFormat.Unknown is allowed for windowed mode.

  • isFullScreen
    [MarshalAsAttribute(U1)] true if the device type will be used in windowed mode; false if the device type will be used in full-screen mode.

Return Value

true if the method succeeds and the device can be used on this adapter; false if the method fails. If the method fails, you may check the result code returned by Manager.CheckDeviceTypeResult to determine the specific reason.

Exceptions

Exception type Condition
DeviceNotSupportedException (Xbox 360) Hardware is the only device type supported on this platform.

Remarks

A hardware abstraction layer (HAL) device type requires hardware acceleration. Applications can use 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 results 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 = SurfaceFormat.Bgr555, valid values for backBufferFormat include SurfaceFormat.Bgr555 and SurfaceFormat.Bgra5551, but exclude SurfaceFormat.Bgr565.

Using 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. No software emulation for the color-converting presentation itself is offered.

See Also

Reference

GraphicsAdapter Class
GraphicsAdapter Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista