GraphicsAdapter.CheckDepthStencilMatch Method

Tests whether a depth stencil format is compatible with a render target format in a particular display mode.

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

public bool CheckDepthStencilMatch (
         DeviceType deviceType,
         SurfaceFormat adapterFormat,
         SurfaceFormat renderTargetFormat,
         DepthFormat depthStencilFormat


The device type.
The format of the display mode into which the adapter will be placed.
The format of the render-target surface to be tested.
The format of the depth stencil surface to be tested.

Return Value

true if the format is compatible; false otherwise.

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

CheckDepthStencilMatch enables applications to work with hardware that requires that certain depth formats work only with certain render target formats.

Xbox 360, Windows XP SP2, Windows Vista