Partager via


Device.DepthStencilSurface Property (Microsoft.DirectX.Direct3D)

Retrieves or sets the depth stencil surface owned by the Device object.

Definition

Visual Basic Public Property DepthStencilSurface As Surface
C# public Surface DepthStencilSurface { get; set; }
C++ public:
property Surface^ DepthStencilSurface {
        Surface^ get();
        void set(Surfacevalue);
}
JScript public function get DepthStencilSurface() : Surface
public function set DepthStencilSurface(Surface);

Property Value

Microsoft.DirectX.Direct3D.Surface
Returns a Surface object that represents the depth stencil surface. If no depth stencil buffer is associated with the device, the return value is null.

Setting this value to null disables the depth stencil operation.This property is read/write. 

Remarks

The following restrictions apply when using this property.

  • The multisample type must be the same for the render target and the depth stencil surface.
  • The formats for the render target and depth stencil surface must be compatible. For more information, see Manager.CheckDepthStencilMatch.
  • The size of the depth stencil surface must be greater than or equal to the size of the render target.

These restrictions are validated only when using the debug runtime when any of the Device drawing methods are called.

Cube textures differ from other surfaces in that they are collections of surfaces. To set a new depth stencil surface with a cube texture, choose an individual face using CubeTexture.GetCubeMapSurface, and pass the resulting surface to this property.

Exceptions

NotFoundException

Occurs if the device does not have a depth stencil buffer associated with it.

InvalidCallException

Occurs if the method call is invalid. For example, a parameter may have an invalid value.