Direct3D 8 - Pixel Shader - Modifiers (Microsoft)

Last edited 2026-01-27


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

For instance, use them to multiply or divide the result by a factor of two, or to clamp the result between zero and one. 


Instruction modifiers are applied after the instruction runs but before writing the result to the destination register.


The meaning of colors in the Type column:

Color

Description

Green

The modifier works in Fusion.

Yellow

The modifier has not been confirmed to work in Fusion.

Red

The instruction does not work in Fusion.

Modifiers instructions

Type

Modifier

Description

Syntax

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

_x2

Multiply by 2

#instruction#_x2

Unknown

Yes

Yes

Yes

Yes

None.

asm

_x4

Multiply by 4

#instruction#_x4

Unknown

Yes

Yes

Yes

Yes

None.

asm

_x8

Multiply by 8

#instruction#_x8

Unknown

No

No

No

Yes

None.

asm

_d2

Divide by 2

#instruction#_d2

Unknown

Yes

Yes

Yes

Yes

None.

asm

_d4

Divide by 4

#instruction#_d4

Unknown

Yes

Yes

Yes

Yes

None.

asm

_d8

Divide by 8

#instruction#_d8

Unknown

No

No

No

Yes

None.

asm

_sat

Saturate (clamp from 0 and 1)

#instruction#_sat

Unknown

Yes

Yes

Yes

Yes

None.


  • The multiply modifier multiplies the register data by a power of two after it is read. This is the same as a shift left.
  • The divide modifier divides the register data by a power of two after it is read. This is the same as a shift right.
  • The saturate modifier clamps the range of register values from zero to one.


Instruction modifiers can be used on arithmetic instructions. They may not be used on texture address instructions.

Quick examples:


// Example 1:
add_x2 r0, t0, t1;          // Assigns the addition colors to t0 from t1 to r0, then multiplies the result by 2

// Example 2:
add_x2_sat r0, t0, t1;      // Assigns the addition of the addition colors to t0 from t1 to r0, then multiplies the result by 2, the result is limited in values ​​0-1

// Example 3:
add_d2, r0, t0, t1;         // Assigns the addition of colors to t0 from t1 to r0, then the result is divided by 2

// Example 4:
add_sat r0, t0, t1;         // Assigns the addition colors of adding t0 from t1 to r0, then the result is bounded from 0 to 1

Created with the Personal Edition of HelpNDoc: Create Professional CHM Help Files with HelpNDoc's Easy-to-Use Tool