Output Color Register
The pixel shader color output registers (oC#) are write-only registers that output results to multiple render targets.
Syntax
Where:
Name | Description |
---|
oC0 | render target #0 of a multiple render target texture |
oC1 | render target #1 of a multiple render target texture |
oC2 | render target #2 of a multiple render target texture |
oC3 | render target #3 of a multiple render target texture |
Remarks
- If oC# is written but there is no corresponding render target in the multiple render-target, then this write to oC# is ignored.
- The render states D3DRS_COLORWRITEENABLE, D3DRS_COLORWRITEENABLE1, D3DRS_COLORWRITEENABLE2 and D3DRS_COLORWRITEENABLE3 determine which components of oC# ultimately get written to the render target (after blend, if applicable). If the shader writes some but not all of the components defined by the D3DRS_COLORWRITEENABLE* render states for a given oC# register, then the unwritten channels produce undefined values in the corresponding render target. If none of the components of an oC# are written, the corresponding render target must not be updated at all (as stated above), so the D3DRS_COLORWRITEENABLE* render states do not apply.
ps_2_0 and ps_2_x Restrictions
- oC# can only be written with the mov instruction.
- oC0 must be always written in the shader.
- No source swizzle (except .xyzw = default swizzle) or source modifier is allowed when writing to any oC#.
- No destination write mask (except .xyzw = default mask) or instruction modifier is allowed when writing to any oC#.
- If oCn is written, then oC0 - oCn-1 must also be written. For example, to write to oC2, you must also write to oC0 and oC1.
- At most one write to any oC# per shader is allowed.
- For ps_2_x and ps_3_0, you cannot write to oC# and oD# registers within dynamic flow control or predication (writes to oC# inside static flow control is fine).
ps_3_0 Restrictions
- For ps_3_0, output registers oC# and oD# can be written any number of times. The output of the pixel shader comes from the contents of the output registers at the end of shader execution. If a write to an output register does not happen, perhaps due to flow control or if the shader just did not write it, the corresponding rendertarget is also not updated. If a subset of the channels in an output register are written, then undefined values will be written to the remaining channels.
- For ps_3_0, the oC# registers can be written with any writemasks.
- For ps_2_x and ps_3_0, you cannot write to oC# and oD# registers within dynamic flow control or predication (writes to oC# inside static flow control is fine).
- You may not perform any gradient calculations (or operations that implicitly invoke gradient calculations such as texld, texldb, texldp) inside of flow control statements whose branching conditions vary on a per-primitive basis (ie: dynamic flow control instructions). Instruction predication is not considered dynamic flow control.