Microsoft DirectX 9.0

Instruction Modifiers (Pixel Shader)

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


Centroid is an optional instruction modifier supported on dcl_usage (which declares input registers) and on texture lookup instructions. The _centroid modifier is appended to an instruction with no space.

The _color usage has special behavior: it assumes that _centroid is set (as a default), so specifying color along with _centroid has no effect. When centroid is set on an input register declaration that is not a _color usage, the attribute evaluation is altered when multisampling. It defines the attribute interpolation to be clamped to the range of the attribute across the primitive when the multisample pixel center is not covered by the primitive. Note that 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. This has no effect on input registers with the _color usage.

This modifier can be also set on the texld* instructions, dsx and dsy. When a texture-coordinate is evaluated at the centroid, the gradient information computed might not be accurate. When this hint is provided, implementations can adjust this gradient computation to be more accurate.

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw

This instruction modifier is not supported on any vertex shader instructions.

Partial Precision

The partial precision hint (represented as _pp in the assembly) can be used by the application to indicate to the device that the operation can be performed and the result stored at a lower precision (at least s10e5). This is a hint and many implementations might ignore it.

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw


Saturates or clamps the instruction result to [0,1] range before writing to the destination register.

add_sat rDest, rSrc0, rSrc1


rDest = clamp_between_0_and_1(rSrc0 + rSrc1).

The saturate instruction modifier costs no additional instruction slots.

The _sat instruction modifier can be used with any arithmetic instruction (including macro-ops), except the frc and sincos instructions.

_sat cannot be used with texture addressing instructions texld* and texkill.

_sat cannot be used with instructions writing to output o# registers.

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw

© 2002 Microsoft Corporation. All rights reserved.