Modifiers for ps_2_0 and Above
Microsoft DirectX 9.0 SDK Update (October 2004)

Modifiers for ps_2_0 and Above


Instruction modifiers affect the result of the instruction before it is written into the destination register.

This section contains reference information for the instruction modifiers implemented by pixel shader version 2_0 and above.

NameSyntax2_02_x2_sw3_03_sw
Saturate_satxxxxx
Partial Precision_ppxxxxx
Centroid_centroidxx

Saturate

The saturate instruction modifier (_sat) saturates (or clamps) the instruction result to the range [0, 1] before writing to the destination register.

The _sat instruction modifier can be used with any instruction except frc, sincos, and any tex* instructions.

For ps_2_0, ps_2_x, and ps_2_sw, the _sat instruction modifier cannot be used with instructions writing to any output registers (Output Color Register or Output Depth Register). This restriction does not apply to ps_3_0 and above.

Example:

dp3_sat r0, v0, c1

Partial Precision

The partial precision instruction modifier (_pp) indicates areas where partial precision is acceptable, provided that the underlying implementation supports it. Implementations are always free to ignore the modifier and perform the affected operations in full precision.

The _pp modifier can occur in two contexts:

Examples:

dcl_texcoord0_pp t1
cmp_pp r0, r1, r2, r3

Centroid

Centroid is an optional instruction modifier (ps_3_0 and above) that modifies the way that sampling locations are altered when multisampling. Centroid clamps the attribute interpolation to the range of the attribute across the primitive, when the multisample pixel center is not covered by the primitive. Gradients computed from such data are not guaranteed to be accurate. Take care when an attribute marked with _centroid is used for texture sampling. Normally the evaluation is performed at the pixel center. Any Input Color Register (v#) declared with a _color* usage will automatically have _centroid applied implicitly.

dcl_texcoord0_centroid v0


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.