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

# OMSetRenderTargets

> Sets CPU descriptor handles for the render targets and depth stencil.

Sets CPU descriptor handles for the render targets and depth stencil.

## Syntax

```cpp theme={null}
void OMSetRenderTargets(
    UINT NumRenderTargetDescriptors,
    const D3D12_CPU_DESCRIPTOR_HANDLE  pRenderTargetDescriptors,
    BOOL RTsSingleHandleToDescriptorRange,
    const D3D12_CPU_DESCRIPTOR_HANDLE  pDepthStencilDescriptor
)
```

### Parameters

*NumRenderTargetDescriptors \[in]*\
Type: UINT

The number of entries in the <i>pRenderTargetDescriptors</i> array (ranges between 0 and **D3D12\_SIMULTANEOUS\_RENDER\_TARGET\_COUNT**). If this parameter is nonzero, the number of entries in the array to which pRenderTargetDescriptors points must equal the number in this parameter.

*pRenderTargetDescriptors \[in, optional]*\
Type: const D3D12\_CPU\_DESCRIPTOR\_HANDLE \*

Specifies an array of [D3D12\_CPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public) structures that describe the CPU descriptor handles that represents the start of the heap of render target descriptors. If this parameter is NULL and NumRenderTargetDescriptors is 0, no render targets are bound.

*RTsSingleHandleToDescriptorRange \[in]*\
Type: BOOL

**True** means the handle passed in is the pointer to a contiguous range of <i>NumRenderTargetDescriptors</i>  descriptors.  This case is useful if the set of descriptors to bind already happens to be contiguous in memory (so all that's needed is a handle to the first one).  For example, if  <i>NumRenderTargetDescriptors</i> is 3 then the memory layout is taken as follows:

<img src="https://mintcdn.com/microsoft-4404708b/5IpvKlT-jmAaVkeY/images/nda/graphics/oms_true.png?fit=max&auto=format&n=5IpvKlT-jmAaVkeY&q=85&s=ca9a65f296f515512968ef8e99ddb20e" alt="Memory layout with parameter set to true" width="221" height="147" data-path="images/nda/graphics/oms_true.png" />

In this case the driver dereferences the handle and then increments the memory being pointed to.

**False** means that the handle is the first of an array of <i>NumRenderTargetDescriptors</i> handles.  The false case allows an application to bind a set of descriptors from different locations at once. Again assuming that <i>NumRenderTargetDescriptors</i> is 3, the memory layout is taken as follows:

<img src="https://mintcdn.com/microsoft-4404708b/5IpvKlT-jmAaVkeY/images/nda/graphics/oms_false.png?fit=max&auto=format&n=5IpvKlT-jmAaVkeY&q=85&s=c88e0ec402d2cb0c624ed18ccc174c42" alt="Memory layout with parameter set to false" width="228" height="222" data-path="images/nda/graphics/oms_false.png" />

In this case the driver dereferences three handles that are expected to be adjacent to each other in memory.

*pDepthStencilDescriptor \[in, optional]*\
Type: const D3D12\_CPU\_DESCRIPTOR\_HANDLE \*

A pointer to a [D3D12\_CPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public) structure that describes the CPU descriptor handle that represents the start of the heap that holds the depth stencil descriptor. If this parameter is NULL, no depth stencil descriptor is bound.

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

[ID3D12GraphicsCommandList](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

- [D3D12_CPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [D3D12_RENDER_TARGET_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_render_target_view_desc_public.md)
- [chat_user_local::set_audio_render_volume](/reference/chat/gamechat2/classes/chat_user/chat_user_local/methods/chat_user_local_set_audio_render_volume.md)
- [D3D12_RENDER_TARGET_BLEND_DESC](/reference/graphics/d3d12/structs/d3d12_render_target_blend_desc_public.md)
- [PartyLocalChatControl::SetAudioRenderVolume](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_setaudiorendervolume.md)
