ID3D12GraphicsCommandList::OMSetRenderTargets method (d3d12.h)

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


void OMSetRenderTargets(
  [in]           UINT                              NumRenderTargetDescriptors,
  [in, optional] const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors,
  [in]           BOOL                              RTsSingleHandleToDescriptorRange,
  [in, optional] const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor


[in] NumRenderTargetDescriptors

Type: UINT

The number of entries in the pRenderTargetDescriptors 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.

[in, optional] pRenderTargetDescriptors


Specifies an array of D3D12_CPU_DESCRIPTOR_HANDLE 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.

[in] RTsSingleHandleToDescriptorRange

Type: BOOL

True means the handle passed in is the pointer to a contiguous range of NumRenderTargetDescriptors 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 NumRenderTargetDescriptors is 3 then the memory layout is taken as follows:

Memory layout with parameter set to true 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 NumRenderTargetDescriptors handles. The false case allows an application to bind a set of descriptors from different locations at once. Again assuming that NumRenderTargetDescriptors is 3, the memory layout is taken as follows:

Memory layout with parameter set to false In this case the driver dereferences three handles that are expected to be adjacent to each other in memory.

[in, optional] pDepthStencilDescriptor


A pointer to a D3D12_CPU_DESCRIPTOR_HANDLE 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



Target Platform Windows
Header d3d12.h
Library D3d12.lib
DLL D3d12.dll

See also