Direct3D 8 - Pixel Shader - 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.

Other instructions

Type

Instruction

Description

Instruction slots

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

ps

Version number

0

Yes

Yes

Yes

Yes

Yes

Defines the pixel shader model used by the assembly program.
Must be the first instruction in the shader source code.

Constant instructions

Type

Instruction

Description

Instruction slots

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

def

Define constants

0

Yes

Yes

Yes

Yes

Yes

Declares a new 4-dimensional constant vector/color.

Phase instructions

Type

Phase instructions

Description

Instruction slots

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

phase

Transition between phase 1 and phase 2

0

No

No

No

No

Yes

Phases allow for almost doubling the number of available instructions for ps.1.4

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 values ​​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.

Texture instructions

Type

Instruction

Description

Instruction slots

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

tex

Sample a texture

1

Yes

Yes

Yes

Yes

No

Assigns texture to texture register.

asm

texbem

Apply a fake bump environment-map transform

1

Yes

Yes

Yes

Yes

No

(Possibly a broken instruction) Assigns a texture with a fake dump transformation applied based on another texture register to the register.

asm

texbeml

Apply a fake bump environment-map transform with luminance correction

1+1²

Yes

Yes

Yes

Yes

No

TODO

asm

texcoord

Interpret texture coordinate data as color data

1

Yes

Yes

Yes

Yes

No

TODO

asm

texcrd

Copy texture coordinate data as color data

1

No

No

No

No

Yes

TODO

asm

texdepth

Calculate depth values

1

No

No

No

No

Yes

TODO

asm

texdp3

Three-component dot product between texture data and the texture coordinates

1

No

No

Yes

Yes

No

TODO

asm

texdp3tex

Three-component dot product and 1D texture lookup

1

No

No

Yes

Yes

No

TODO

asm

texkill

Cancels rendering of pixels based on a comparison

1

Yes

Yes

Yes

Yes

Yes

TODO

asm

texld

Sample a texture

1

No

No

No

No

Yes

TODO

asm

texm3x2depth

Calculate per-pixel depth values

1

No

No

No

Yes

No

TODO

asm

texm3x2pad

First row matrix multiply of a two-row matrix multiply

1

Yes

Yes

Yes

Yes

No

TODO

asm

texm3x2tex

Final row matrix multiply of a two-row matrix multiply

1

Yes

Yes

Yes

Yes

No

TODO

asm

texm3x3

3x3 matrix multiply

1

No

No

Yes

Yes

No

TODO

asm

texm3x3pad

First or second row multiply of a three-row matrix multiply

1

Yes

Yes

Yes

Yes

No

TODO

asm

texm3x3spec

Final row multiply of a three-row matrix multiply

1

Yes

Yes

Yes

Yes

No

TODO

asm

texm3x3tex

Texture look up using a 3x3 matrix multiply

1

Yes

Yes

Yes

Yes

No

TODO

asm

texm3x3vspec

Texture look up using a 3x3 matrix multiply, with non-constant eye-ray vector

1

Yes

Yes

Yes

Yes

No

TODO

asm

texreg2ar

Sample a texture using the alpha and red components

1

Yes

Yes

Yes

Yes

No

TODO

asm

texreg2gb

Sample a texture using the green and blue components

1

Yes

Yes

Yes

Yes

No

TODO

asm

texreg2rgb

Sample a texture using the red, green and blue components

1

No

No

Yes

Yes

No

TODO

Created with the Personal Edition of HelpNDoc: Make the switch to CHM with HelpNDoc's hassle-free WinHelp HLP to CHM conversion tool