Direct3D 8 - Pixel Shader - Arithmetic instructions (Microsoft) (Source 2)

Last edited 2026-01-27


This section contains reference information for the pixel shader version ps.1.x instructions.

There are several types of pixel shader instructions, as shown in the following table.


for Instruction slots means:

  • The number 1 indicates that the instruction occupies 1 instruction slot in the pixel shader limit.
  • The number ¹ means that in different versions of the pixel shader, the number of instructions may vary.


The meaning of colors in the Type column:

Color

Description

Green

The instruction works in Fusion.

Yellow

The instruction has not been confirmed to work in Fusion.

Red

The instruction does not work in Fusion.

Arithmetic instructions

Type

Instruction

Description

Instruction slots

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

add

Add two vectors

1

Yes

Yes

Yes

Yes

Yes

Assigns the sum of two values ​​to the target.

asm

bem

Apply a fake bump environment-map transform

2

No

No

No

No

Yes

Used to modify texCoords based on two texture.

asm

cmp

Compare source to 0

No

No

Yes

Yes

Yes

An IF/ELSE condition that checks whether the given number is greater or eqaul than 0 and assigns the appropriate color.

asm

cnd

Compare source to 0.5

1

Yes

Yes

Yes

Yes

Yes

An IF/ELSE condition that checks whether the given number is greater than 0.5 and assigns the appropriate color.

asm

dp3

Three-component dot product

1

Yes

Yes

Yes

Yes

Yes

Multiplies vectors (red with red, green with green, blue with blue) and adds them all together, returning the sum.

asm

dp4

Four-component dot product

No

No

Yes

Yes

Yes

Multiplies vectors (red with red, green with green, blue with blue, alpha with alpha) and adds them all together, returning the sum.

asm

lrp

Linear interpolate

1

Yes

Yes

Yes

Yes

Yes

Returns linear interpolate value ​​between x and y, depending on t.

asm

mad

Multiply and add

1

Yes

Yes

Yes

Yes

Yes

Uses multiplication and addition in one instruction slot.

asm

mov

Move

1

Yes

Yes

Yes

Yes

Yes

Assigns the given value to the target.

asm

mul

Multiply

1

Yes

Yes

Yes

Yes

Yes

Assigns the multiplication of two values ​​to a target.

asm

nop

No operation

0

Yes

Yes

Yes

Yes

Yes

This instruction does nothing.

asm

sub

Subtract

1

Yes

Yes

Yes

Yes

Yes

Assigns the difference of two values ​​to the target.

Created with the Personal Edition of HelpNDoc: iPhone web sites made easy