Pixel Shader Source Register Modifiers
Microsoft DirectX 9.0 SDK Update (October 2004)

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
1_11_21_31_4
biasregister_biasXXXX
invert1 - registerXXXX
negate- registerXXXX
scale by 2register_x2X
signed scalingregister_bx2XXXX
texld and texcrd modifiersregister_d*XXXX
source register swizzlingregister.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:

ps_2_0 and Above

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

Negate

Negate the contents of the source register.

Component modifier Description
- r Source negation

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

Pixel shader versions2_02_x2_sw3_03_sw
-xxxxx

Absolute Value

Take the absolute value of the register.

Pixel shader versions2_02_x2_sw3_03_sw
absxx

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



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