Pixel Shader Source Register Modifiers

Use source register modifiers to change the value read from a register before an instruction runs. 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.

ps_1_1 - ps_1_4

This table identifies the versions that support each modifier:

Source register modifiersSyntaxVersion
bias register_biasXXXX
invert 1 - registerXXXX
negate - registerXXXX
scale by 2 register_x2X
signed scaling register_bx2XXXX
texld and texcrd modifiers register_d*XXXX
source register swizzling register.xyzwXXXX


Source register modifiers can be used only on arithmetic instructions. They cannot be used on texture address instructions. The exception to this is the scale by 2 modifier. For version 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 scalex2 modifier. When combined, negate is run last.
  • Invert cannot be combined with any other modifier.
  • Invert, negate, bias, signed scaling, and scalex2 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.

ps_2_0 and Above

For version ps_2_0 and up, the number of modifiers has been simplified.


Negate the contents of the source register.

Component modifierDescription
- rSource negation


The negate modifier cannot be used on second source register of these instructions: m3x2 - ps, m3x3 - ps, m3x4 - ps, m4x3 - ps, and m4x4 - ps.

Pixel shader versions2_02_x2_sw3_03_sw


Absolute Value

Take the absolute value of the register.

Pixel shader versions2_02_x2_sw3_03_sw


If any version 3 shader reads from one or more constant float registers (c#), one of the following must be true.

  • All of the constant floating-point registers must use the abs modifier.
  • None of the constant floating-point registers can use the abs modifier.

Related topics

Pixel Shader Register Modifiers