Output Depth Register
The pixel shader output depth register (oDepth) is a write-only scalar register that returns a new depth value for a depth test against the depth-stencil buffer.
Syntax
Where:
Name | Description |
---|
oDepth | New depth value for a depth test against the depth-stencil buffer |
Remarks
- Replicate source swizzle (.x | .y | .z | .w) is required when writing to oDepth.
- No explicit destination write mask is allowed when writing to oDepth.
- If no depth buffer has been created or attached to the device, then write to oDepth is ignored.
- If an application has a w-buffer set as its depth buffer, then it needs to take that into account while writing to oDepth. It potentially needs to send w-range information to the pixel shader and compute the w-range to scale the w-values written out to oDepth.
ps_2_0 and ps_2_x Restrictions
- oDepth can only be written with the mov instruction.
- No source modifier is allowed when writing to oDepth.
- No instruction modifier is allowed when writing to oDepth.
- At most one write to oDepth per shader is allowed.
- Writing to oDepth from within a dynamic flow control construct, a static flow control construct, or using predication will produce undefined results.
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_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.