> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateDepthStencilView

> Creates a depth-stencil view for accessing resource data.

Creates a depth-stencil view for accessing resource data.

## Syntax

```cpp theme={null}
void CreateDepthStencilView(
    ID3D12Resource  pResource,
    const D3D12_DEPTH_STENCIL_VIEW_DESC  pDesc,
    D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor
)
```

### Parameters

*pResource \[in, optional]*\
Type: ID3D12Resource \*

A pointer to the [ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs) object that represents the depth stencil.

At least one of <i>pResource</i> or <i>pDesc</i>  must be provided.
A null <i>pResource</i> is used to initialize a null descriptor, which guarantees D3D11-like null binding behavior (reading 0s, writes are discarded), but must have a valid <i>pDesc</i> in order to determine the descriptor type.

*pDesc \[in, optional]*\
Type: const D3D12\_DEPTH\_STENCIL\_VIEW\_DESC \*

A pointer to a [D3D12\_DEPTH\_STENCIL\_VIEW\_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_view_desc_public) structure that describes the depth-stencil view.

A null <i>pDesc</i> is used to initialize a default descriptor, if possible. This behavior is identical to the D3D11 null descriptor behavior, where defaults are filled in. This behavior inherits the resource format and dimension (if not typeless) and DSVs target the  first mip and all array slices. Not all resources support null descriptor initialization.

*DestDescriptor \[in]*\
Type: D3D12\_CPU\_DESCRIPTOR\_HANDLE

Describes the CPU descriptor handle that represents the start of the heap that holds the depth-stencil view.

### Return value

Type: void

None.

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)


## Related topics

- [D3D12_DEPTH_STENCIL_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_view_desc_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [CreatePlacedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createplacedresource_public.md)
- [D3D12_RENDER_PASS_DEPTH_STENCIL_DESC](/reference/graphics/d3d12/structs/d3d12_render_pass_depth_stencil_desc_public.md)
- [D3D12_CLEAR_VALUE](/reference/graphics/d3d12/structs/d3d12_clear_value_public.md)
