Bind one or more render targets and the depth-stencil buffer to the output-merger stage.
void OMSetRenderTargets( [in] UINT NumViews, [in] ID3D10RenderTargetView *const *ppRenderTargetViews, [in] ID3D10DepthStencilView *pDepthStencilView );
- NumViews [in]
Number of render targets to bind.
- ppRenderTargetViews [in]
Pointer to an array of render targets (see ID3D10RenderTargetView) to bind to the device. If this parameter is NULL, no render targets are bound. See Remarks.
- pDepthStencilView [in]
Pointer to a depth-stencil view (see ID3D10DepthStencilView) to bind to the device. If this parameter is NULL, the depth-stencil state is not bound.
A call to OMSetRenderTargets overrides all bounded render targets and the depth stencil target regardless of the number of render targets in ppRenderTargetViews.
The maximum number of render targets a device can have active at any given time is set by a #define in D3D10.h called D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT. It is invalid to try to set the same subresource to multiple render target slots.
If any subresources are also currently bound for reading or writing (perhaps in a different part of the pipeline), those bind points will be NULL'ed out to prevent the same subresource from being read and written simultaneously in a single rendering operation.
The method will not hold references to the interfaces passed in. For that reason, applications should be careful not to release interfaces currently in use by the device.
See Binding Resources and Pipeline stages for more information on binding resources.
The pixel shader must be able to simultaneously render to at least eight separate render targets. All of these render targets must access the same type of resource: Buffer, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, or TextureCube. All render targets must have the same size in all dimensions (width and height, and depth for 3D or array size for *Array types). If render targets use multisample anti-aliasing, all bound render targets and depth buffer must be the same form of multisample resource (that is, the sample counts must be the same). Each render target can have a different data format. These render target formats are not required to have identical bit-per-element counts.
Any combination of the eight slots for render targets can have a render target set or not set.
The same resource view cannot be bound to multiple render target slots simultaneously. However, you can set multiple non-overlapping resource views of a single resource as simultaneous multiple render targets.