PFND3D11DDI_SETRENDERTARGETS callback function (d3d10umddi.h)

The SetRenderTargets(D3D11) function sets render target surfaces.

Syntax

PFND3D11DDI_SETRENDERTARGETS Pfnd3d11ddiSetrendertargets;

void Pfnd3d11ddiSetrendertargets(
  [in] D3D10DDI_HDEVICE unnamedParam1,
  [in] const D3D10DDI_HRENDERTARGETVIEW *unnamedParam2,
  [in] UINT NumRTVs,
  [in] UINT ClearSlots,
  [in] D3D10DDI_HDEPTHSTENCILVIEW unnamedParam5,
  [in] const D3D11DDI_HUNORDEREDACCESSVIEW *unnamedParam6,
  [in] const UINT *unnamedParam7,
       UINT UAVStartSlot,
  [in] UINT NumUAVs,
  [in] UINT UAVRangeStart,
  [in] UINT UAVRangeSize
)
{...}

Parameters

[in] unnamedParam1

hDevice: A handle to the display device (graphics context).

[in] unnamedParam2

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

[in] NumRTVs

The number of elements in the array provided in phRenderTargetView for the RTVs to set.

[in] ClearSlots

The number of RTV objects to unbind; that is, those render target view objects that were previously bound but no longer need to be bound.

[in] unnamedParam5

hDepthStencilView: A handle to the depth-stencil buffer to set.

[in] unnamedParam6

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

[in] unnamedParam7

pUAVInitialCounts: An array of append and consume buffer offsets. This parameter is only relevant for 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, it 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.

UAVStartSlot

Index of the first UAV to bind. UAVStartSlot must be at least as great as the NumRTVs parameter.

Note

Only one shared set of binding points exists for RTVs and UAVs. RTVs are bound first, followed by UAVs.

[in] NumUAVs

The number of UAVs to bind.

[in] UAVRangeStart

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

[in] UAVRangeSize

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

Return value

None

Remarks

Resource descriptors such as RTVs and UAVs must be bound (put in input slots) before shaders can access them for read or write.

The following image shows an example with five resources.

RTV and UAV example.

In the above example:

  • NumRTVs = 2
  • UAVStartSlot = 2
  • NumUAVs = 3

NumUAVs and UAVStartSlot specify which range in the UAVs array contains changes in relation to the state that was previously bound. Note that the points in the range could be unchanged.

The UAVRangeStart and UAVRangeSize parameters are a convenience that reveal the span of what actually changed given that the Direct3D DDI always binds everything (including what has not changed). The D3D11 runtime formulates them on the application's behalf as additional information for driver writers as hints for possible optimization. Typically, the D3D11 runtime will call this function with UAVRangeStart and UAVRangeSize values to indicate the whole range. Using the above example:

  • To choose the whole range (no change believed to happen), UAVRangeStart = 2 and UAVRangeSize = 3.
  • To indicate that just the first UAV might have changed, UAVRangeStart = 2 and UAVRangeSize = 1.

The driver can use the pfnSetErrorCb callback function to set an error code.

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 will determine that the error is critical. Even if the device was removed, the driver is not required to return D3DDDIERR_DEVICEREMOVED; however, if device removal interfered with the operation of SetRenderTargets (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.

Requirements

Requirement Value
Minimum supported client SetRenderTargets(D3D11) is supported beginning with the Windows 7 operating system.
Target Platform Desktop
Header d3d10umddi.h (include D3d10umddi.h)

See also

D3D11DDIARG_BUFFER_UNORDEREDACCESSVIEW

D3D11DDI_DEVICEFUNCS

pfnSetErrorCb