IDirect3DDevice9::SetDepthStencilSurface method (d3d9helper.h)

Sets the depth stencil surface.

Syntax

HRESULT SetDepthStencilSurface(
  [in] IDirect3DSurface9 *pNewZStencil
);

Parameters

[in] pNewZStencil

Type: IDirect3DSurface9*

Address of a pointer to an IDirect3DSurface9 interface representing the depth stencil surface. Setting this to NULL disables the depth stencil operation.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If pZStencilSurface is other than NULL, the return value is D3DERR_INVALIDCALL when the stencil surface is invalid.

Remarks

Restrictions for using this method include the following:

  • The multisample type must be the same for the render target and the depth stencil surface.
  • The formats must be compatible for the render target and the depth stencil surface. See IDirect3D9::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 IDirect3DDevice9Draw methods are called.

Cube textures differ from other surfaces in that they are collections of surfaces. To call IDirect3DDevice9::SetDepthStencilSurface with a cube texture, you must select an individual face using IDirect3DCubeTexture9::GetCubeMapSurface and pass the resulting surface to IDirect3DDevice9::SetDepthStencilSurface.

Requirements

Requirement Value
Target Platform Windows
Header d3d9helper.h (include D3D9.h)
Library D3D9.lib

See also

IDirect3DDevice9

IDirect3DDevice9::GetDepthStencilSurface