Binds resources to the output-merger stage.
Syntax
void OMSetRenderTargetsAndUnorderedAccessViews( [in] UINT NumViews, [in] ID3D11RenderTargetView **ppRenderTargetViews, [in] ID3D11DepthStencilView **ppDepthStencilView, [in] UINT UAVStartSlot, [in] UINT NumUAVs, [in] ID3D11UnorderedAccessView **ppUnorderedAccessView, [in] const UINT *pUAVInitialCounts );
Parameters
- NumViews [in]
-
Type: UINT
Number of render-target views (ppRenderTargetViews) and depth-stencil view (ppDepthStencilView) to bind. If you set NumViews to D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL (0xffffffff), this method does not modify the currently bound render-target views (RTVs) and also does not modify depth-stencil view (DSV).
- ppRenderTargetViews [in]
-
Type: ID3D11RenderTargetView**
Pointer to an array of ID3D11RenderTargetViews, which represent render-target views. Specify NULL to set none.
- ppDepthStencilView [in]
-
Type: ID3D11DepthStencilView**
Pointer to a ID3D11DepthStencilView, which represents a depth-stencil view. Specify NULL to set none.
- UAVStartSlot [in]
-
Type: UINT
Index into a zero-based array to begin setting unordered-access views (ranges from 0 to D3D11_PS_CS_UAV_REGISTER_COUNT - 1).
For the Direct3D 11.1 runtime, which is available starting with Windows 8, this value can range from 0 to D3D11_1_UAV_SLOT_COUNT - 1. D3D11_1_UAV_SLOT_COUNT is defined as 64.
For pixel shaders, UAVStartSlot should be equal to the number of render-target views being bound.
- NumUAVs [in]
-
Type: UINT
Number of unordered-access views (UAVs) in ppUnorderedAccessView. If you set NumUAVs to D3D11_KEEP_UNORDERED_ACCESS_VIEWS (0xffffffff), this method does not modify the currently bound unordered-access views.
For the Direct3D 11.1 runtime, which is available starting with Windows 8, this value can range from 0 to D3D11_1_UAV_SLOT_COUNT - UAVStartSlot.
- ppUnorderedAccessView [in]
-
Type: ID3D11UnorderedAccessView**
Pointer to an array of ID3D11UnorderedAccessViews, which represent unordered-access views.
- pUAVInitialCounts [in]
-
Type: const UINT*
An array of append and consume buffer offsets. A value of -1 indicates to keep the current offset. Any other values set the hidden counter for that appendable and consumable UAV. pUAVInitialCounts is relevant only for UAVs that were created with either D3D11_BUFFER_UAV_FLAG_APPEND or D3D11_BUFFER_UAV_FLAG_COUNTER specified when the UAV was created; otherwise, the argument is ignored.
Return value
This method does not return a value.
Remarks
For pixel shaders, the render targets and unordered-access views share the same resource slots when being written out. This means that UAVs must be given an offset so that they are placed in the slots after the render target views that are being bound.
Note RTVs, DSV, and UAVs cannot be set independently; they all need to be set at the same time.
Two RTVs conflict if they share a subresource (and therefore share the same resource).
Two UAVs conflict if they share a subresource (and therefore share the same resource).
An RTV conflicts with a UAV if they share a subresource or share a bind point.
OMSetRenderTargetsAndUnorderedAccessViews operates properly in the following situations:
-
NumViews != D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL and NumUAVs != D3D11_KEEP_UNORDERED_ACCESS_VIEWS
The following conditions must be true for OMSetRenderTargetsAndUnorderedAccessViews to succeed and for the runtime to pass the bind information to the driver:
- NumViews <= 8
- UAVStartSlot >= NumViews
- UAVStartSlot + NumUAVs <= 8
- There must be no conflicts in the set of all ppRenderTargetViews and ppUnorderedAccessView.
- ppDepthStencilView must match the render-target views. For more information about resource views, see Introduction to a Resource in Direct3D 11.
OMSetRenderTargetsAndUnorderedAccessViews performs the following tasks:
- Unbinds all currently bound conflicting resources (stream-output target resources (SOTargets), compute shader (CS) UAVs, shader-resource views (SRVs)).
- Binds ppRenderTargetViews, ppDepthStencilView, and ppUnorderedAccessView.
-
NumViews == D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL
In this situation, OMSetRenderTargetsAndUnorderedAccessViews binds only UAVs.
The following conditions must be true for OMSetRenderTargetsAndUnorderedAccessViews to succeed and for the runtime to pass the bind information to the driver:
- UAVStartSlot + NumUAVs <= 8
- There must be no conflicts in ppUnorderedAccessView.
OMSetRenderTargetsAndUnorderedAccessViews unbinds the following items:
- All RTVs in slots >= UAVStartSlot
- All RTVs that conflict with any UAVs in ppUnorderedAccessView
- All currently bound resources (SOTargets, CS UAVs, SRVs) that conflict with ppUnorderedAccessView
OMSetRenderTargetsAndUnorderedAccessViews binds ppUnorderedAccessView.
OMSetRenderTargetsAndUnorderedAccessViews ignores ppDepthStencilView, and the current depth-stencil view remains bound.
-
NumUAVs == D3D11_KEEP_UNORDERED_ACCESS_VIEWS
In this situation, OMSetRenderTargetsAndUnorderedAccessViews binds only RTVs and DSV.
The following conditions must be true for OMSetRenderTargetsAndUnorderedAccessViews to succeed and for the runtime to pass the bind information to the driver:
- NumViews <= 8
- There must be no conflicts in ppRenderTargetViews.
- ppDepthStencilView must match the render-target views. For more information about resource views, see Introduction to a Resource in Direct3D 11.
OMSetRenderTargetsAndUnorderedAccessViews unbinds the following items:
- All UAVs in slots < NumViews
- All UAVs that conflict with any RTVs in ppRenderTargetViews
- All currently bound resources (SOTargets, CS UAVs, SRVs) that conflict with ppRenderTargetViews
OMSetRenderTargetsAndUnorderedAccessViews binds ppRenderTargetViews and ppDepthStencilView.
OMSetRenderTargetsAndUnorderedAccessViews ignores UAVStartSlot.
Windows Phone 8: This API is supported.
Requirements
|
Header |
|
|---|---|
|
Library |
|
See also
Send comments about this topic to Microsoft
Build date: 11/28/2012