> ## 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.

# CreateRenderTargetView

> Creates a render-target view for accessing resource data. (ID3D12Device.CreateRenderTargetView)

Creates a render-target view for accessing resource data.

## Syntax

```cpp theme={null}
void CreateRenderTargetView(
    ID3D12Resource  pResource,
    const D3D12_RENDER_TARGET_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 render target.

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\_RENDER\_TARGET\_VIEW\_DESC \*

A pointer to a [D3D12\_RENDER\_TARGET\_VIEW\_DESC](/reference/graphics/d3d12/structs/d3d12_render_target_view_desc_public) structure that describes the render-target 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 RTVs 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 destination where the newly-created render target view will reside.

### 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_RENDER_TARGET_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_render_target_view_desc_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [D3D12_RTV_DIMENSION](/reference/graphics/d3d12/enums/d3d12_rtv_dimension_public.md)
- [CreatePlacedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createplacedresource_public.md)
- [D3D12_RENDER_PASS_RENDER_TARGET_DESC](/reference/graphics/d3d12/structs/d3d12_render_pass_render_target_desc_public.md)
