Export (0) Print
Expand All
Expand Minimize

SetRenderTargets(D3D11) routine

The SetRenderTargets(D3D11) function sets render target surfaces.



VOID APIENTRY SetRenderTargets(
  _In_       D3D10DDI_HDEVICE              hDevice,
  _In_ const D3D10DDI_HRENDERTARGETVIEW    *phRenderTargetView,
  _In_       UINT                          NumRTVs,
  _In_       UINT                          RTVNumbertoUnbind,
  _In_       D3D10DDI_HDEPTHSTENCILVIEW    hDepthStencilView,
  _In_ const D3D11DDI_HUNORDEREDACCESSVIEW *phUnorderedAccessView,
  _In_ const UINT                          *pUAVInitialCounts,
  _In_       UINT                          UAVIndex,
  _In_       UINT                          NumUAVs,
  _In_       UINT                          UAVFirsttoSet,
  _In_       UINT                          UAVNumberUpdated
{ ... }


hDevice [in]

A handle to the display device (graphics context).

phRenderTargetView [in]

An array of handles to the render target view objects to set. Note that some handle values can be NULL.

NumRTVs [in]

The number of elements in the array that phRenderTargetView specifies for the render target views (RTVs) to set.

RTVNumbertoUnbind [in]

The number of render target view (RTV) objects to unbind (that is, those render target view objects that are previously set but should be no longer set).

hDepthStencilView [in]

A handle to the depth-stencil buffer to set.

phUnorderedAccessView [in]

An array of handles to the unordered access view (UAV) objects.

pUAVInitialCounts [in]

An array of append and consume buffer offsets. pUAV is only relevant for unordered access views (UAVs) of the phUnorderedAccessView array that were created with either D3D11_DDI_BUFFER_UAV_FLAG_APPEND or D3D11_DDI_BUFFER_UAV_FLAG_COUNTER set in the Flags member of the D3D11DDIARG_BUFFER_UNORDEREDACCESSVIEW structure when the UAV was created; otherwise, the argument is ignored. If an element in this array is set to -1, the current offset for that append and consume buffer should be kept. Any other value causes the driver to set the hidden counter for that UAV append and consume buffer.

UAVIndex [in]

Indicates the start element, in the array of bind points, where the passed unordered access view (UAV) array is going to be applied. UAVIndex should be at least as great as the NumRTVs parameter.

Note  Only one shared set of binding points exists for render target views (RTVs) and UAVs. RTVs are bound first, followed by UAVs.
NumUAVs [in]

The number of unordered access view objects (UAVs) to set.

UAVFirsttoSet [in]

The first unordered access view object (UAV) in the set of all updated UAVs (which includes NULL bindings).

UAVNumberUpdated [in]

The number of unordered access view objects (UAVs) in the set of all updated UAVs (which includes NULL bindings).

Note  The parameters UAVNumberUpdated and UAVFirsttoSet specify which range, in the UAVs array, contains changes in relation to the state previously bound. Notice that points in the range could be unchanged. Also, update range indexing is not different from other parameters. For example, UAVFirsttoSet starts at 0 as the first element of the shared render target view (RTV) and UAV bound space. This parameter is a convenience that reveals the span of what actually changed given that the Direct3D DDI always binds everything (including what has not changed).

Return value


The driver can use the pfnSetErrorCb callback function to set an error code. For more information about setting error codes, see the following Remarks section.


The driver should not encounter any error, except for D3DDDIERR_DEVICEREMOVED. Therefore, if the driver passes any error, except for D3DDDIERR_DEVICEREMOVED, in a call to the pfnSetErrorCb function, the Microsoft Direct3D runtime determines that the error is critical. Even if the device is removed, the driver is not required to return D3DDDIERR_DEVICEREMOVED; however, if device removal interferes with the operation of SetRenderTargets(D3D11) (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.


Target platform



SetRenderTargets(D3D11) is supported beginning with the Windows 7 operating system.


D3d10umddi.h (include D3d10umddi.h)

See also




Send comments about this topic to Microsoft

© 2015 Microsoft