Multiple Render Target
Many implementations support a less restrictive form of Multiple Render Target. The biggest relaxation is the ability to have multiple render targets that can be created independently. These render targets must be of identical dimensions but can have different formats. The pipeline supports a single render target that can be set using IDirect3DDevice9::SetRenderTarget. This has been extended to allow multiple render targets to be simultaneously present in the device. A new cap expresses this ability.
Multiple render targets have the following restrictions:
- Some implementations might require all surfaces of multiple render targets to have the same bit depth but allow different formats. Implementations that do not have this limitation indicate so by setting the cap D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS.
If the D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS cap is set, the device can support all mixed formats regardless of format type or bit depth. If the D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS cap is not set, the device can support mixed format types for surfaces containing the same bit depth above 16 bits. The mixing of different format types for 16-bit depth surfaces is undefined.
- All surfaces of a multiple render target should have the same width and height.
- Some implementations cannot perform post-pixel shader operations on multiple render targets, including: no dithering, alpha test, no fogging, no blending or masking, except the z-test and stencil test. Devices that can support post-pixel shader operations set the cap bit to D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING. When the D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING cap is not set, the device is expected to turn off all post-pixel shader blending operations, regardless of what the specific surface IDirect3D9::CheckDeviceFormat with USAGE_QUERY_POSTPIXELSHADER_BLENDING is.
When the D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING cap is set, you must first consult the IDirect3D9::CheckDeviceFormat with the USAGE_QUERY_POSTPIXELSHADER_BLENDING result for the specific surface format. If false, no post-pixel shader blending operations will be available for that specific surface format. If true, the device is expected to apply the same state to all simultaneous render targets as follows:
- Alpha blend: The color value in oCi is blended with the ith render target.
- Alpha test: Comparison will happen with oC0. If the comparison fails, the pixel test is terminated for all render targets.
- Fog: Render target 0 will get fogged. Other render targets are undefined. Implementations can choose to fog them all using the same state.
- Dithering: Undefined.
- No antialiasing is supported.
- Some of the implementations do not apply the output write mask (D3DRS_COLORWRITEENABLE). Those that can, have independent color write masks. This is expressed using a new capability bit. The number of independent color write masks available will be equal to the maximum number of elements the device is capable of.
- IDirect3DDevice9::Clear clears all surfaces of the multiple render target.
In the past, this application programming interface (API) was used to set the depth stencil as well. In Microsoft?DirectX?9.0 however, this API has been split up as documented in the IDirect3DDevice9::SetRenderTarget
New hardware caps:
// The value is 1 for all hardware except those that
// can support this feature. It is never 0.
D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - True if the hardware can support it
D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING - True if the hardware can support it