![]() |
![]() |
![]() |
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.
This table identifies the versions that support each modifier:
Source register modifiers | Syntax | Version | |||||
---|---|---|---|---|---|---|---|
1_1 | 1_2 | 1_3 | 1_4 | ||||
bias | register_bias | X | X | X | X | ||
invert | 1 - register | X | X | X | X | ||
negate | - register | X | X | X | X | ||
scale by 2 | register_x2 | X | |||||
signed scaling | register_bx2 | X | X | X | X | ||
texld and texcrd modifiers | register_d* | X | X | X | X | ||
source register swizzling | register.xyzw | 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 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:
For version ps_2_0 and up, the number of modifiers has been simplified.
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 versions | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|
- | x | x | x | x | x |
Take the absolute value of the register.
Pixel shader versions | 2_0 | 2_x | 2_sw | 3_0 | 3_sw |
---|---|---|---|---|---|
abs | x | x |
If any version 3 shader reads from one or more constant float registers (c#), one of the following must be true.