Register Modifiers

DirectX8

Microsoft Directx 8.1 (pixel shader versions 1.0, 1.1, 1.2, 1.3, 1.4)

Source Register Modifiers

Use source register modifiers to change the value read from a register before an instruction executes. The contents of a source register are left unchanged. Modifiers are useful for adjusting the range of register data in preparation for the instruction. A set of modifiers called selectors copies or replicates the data from a single channel (r,g,b,a) into the other channels.

Version 1.4 shaders have modifier functionality specific to shader instructions texld and texcrd. These modifiers affect version 1.4 texture registers and are detailed in Texture Register Modifiers.

Source register modifiers SyntaxVersion
1.0 1.1 1.2 1.3 1.4
Bias register_bias X X X X X
Invert 1 - register X X X X X
Negate - register X X X X X
Scale×2 register_x2 X
Signed Scaling register_bx2 X X X X X

Source register modifiers can be used only on arithmetic instructions. They cannot be used on texture address instructions. The exception to this is the signed scale modifier (_bx2). For version 1.0 and 1.1, signed scale can be used on the source argument of any texm* instruction. For version 1.2 or 1.3, signed scale can be used on the source argument of any texture address instruction.

Some modifier specific restrictions:

  • Negate can be combined with either the bias, signed scaling, or scale×2 modifier. When combined, negate is executed last.
  • Invert cannot be combined with any other modifier.
  • Invert, negate, bias, signed scaling, and scale×2 can be combined with any of the selectors.
  • Source register modifiers should not be used on constant registers because they will cause undefined results. For version 1.4, modifiers on constants are not allowed and will fail validation.