Direct3D 8 - Pixel Shader - Input/Output Registers

Last edited 2026-01-27


For Pixel Shader 1.0 to 1.4, they rely on registers to:

  • Fetch vertex data
  • Output pixel data
  • Store temporary results during computation
  • Identify texture sampling steps

Input/Output registers for Pixel Shader (Microsoft)

Information for the entire table:

    • The Register column describes what it looks like. The "#" should be replaced by a value, for example: "c0", "t1", "r0", "v2". The description describes the register's purpose.
    • Read Port Limit describes the restrictions on using multiple registers in a single instruction.
    • Read-Only or Read/Write describes which registers can be used for reading, writing, or both.
    • Range describes the component's data range. (In Fusion 2.5, the value of `PixelShader1xMaxValue` and `MaxTextureRepeat` is unknown)


Type

Register

Description

Input / Output

ps.1.0

ps.1.1

ps.1.2

ps.1.3

ps.1.4

Note

asm

c#

Constant register

Input

Unknown

Count: 8
Read limit: 2

Read-Only

Range: -1 to 1

Count: 8
Read limit: 2

Read-Only

Range: -1 to 1

Count: 8
Read limit: 2

Read-Only

Range: -1 to 1

Count: 8
Read limit: 2

Read-Only

Range: -1 to 1


asm

r#

Temporary register

Internal


They are neither input nor output of the shader

Unknown

Count: 2
Read limit: 2

Read/Write

Range: -PixelShader1xMaxValue to PixelShader1xMaxValue

Count: 2
Read limit: 2

Read/Write

Range: -PixelShader1xMaxValue to PixelShader1xMaxValue

Count: 2
Read limit: 2

Read/Write

Range: -PixelShader1xMaxValue to PixelShader1xMaxValue

Count: 6
Read limit: 3

Read/Write

Range: -PixelShader1xMaxValue to PixelShader1xMaxValue


asm

t#

Texture register

Input

Unknown

Count: 4
Read limit: 2

Read/Write

Range: -MaxTextureRepeat to      MaxTextureRepeat

Count: 4
Read limit: 3

Read/Write

Range: -MaxTextureRepeat to MaxTextureRepeat

Count: 4
Read limit: 3

Read/Write

Range: -MaxTextureRepeat to MaxTextureRepeat

Count: 6
Read limit: 1

*See following note*

Range: -MaxTextureRepeat to MaxTextureRepeat

For ps.1.4, texture registers are RO for texture addressing instructions, and texture registers can be neither read from nor written to by arithmetic instructions. 


Also, because texture registers have become texture coordinate registers, having RO access is not a regression of previous functionality.

asm

v#

Color register

Input

Unknown

Count: 4
Read limit: 2

Read/Write

Range: 0 to 1

Count: 2
Read limit: 2

Read-Only

Range: 0 to 1

Count: 2
Read limit: 2

Read-Only

Range: 0 to 1

Count: 2 in phase 2
Read limit: 2

Read-Only

Range: 0 to 1


Description of each register

Constant register:

Contain constant data. Data can be loaded into a constant register using the def instruction. Constant registers are not suitable for use in texture addressing instructions. The only exception is the texm3x3spec instruction, which uses a constant register to provide the eye radiation vector.


Temporary register:

Used to store intermediate results. r0 also serves as the output of the pixel shader. The value in r0 at the end of the shader is the pixel color for the shader.


Texture register:

For pixel shader versions ps.1.1 through ps.1.3, texture registers contain texture data or texture coordinates.

Texture data is loaded into a texture register during texture sampling.

Texture sampling uses texture coordinates to lookup or sample color values ​​at specific coordinates (U'V, W'Q), taking into account the texture stage state attributes.

Texture coordinate data is interpolated from the vertex texture coordinate data and is associated with a specific texture stage.

There is a default one-to-one correspondence between the texture stage number and the texture coordinate declaration order.

By default, the first set of texture coordinates defined in the vertex format is associated with texture stage 0.

      • For these pixel shader versions, texture registers behave the same as temporary registers when used by arithmetic instructions.
      • For Pixel Shader version ps.1.4, the (t#) texture registers contain read-only texture coordinate data.


This means that the texture coordinate set and the texture stage number are independent of each other. The texture stage number (from which the texture can be sampled) is specified by the destination register number (r0 to r5).

For the texld instruction, the texture coordinate set is specified by the source register (t0 to t5), allowing the texture coordinate set to be mapped to any texture stage.

Furthermore, the source register (specifying the texture coordinates) for texld can also be the temporary register (r#), in which case the contents of the temporary register are used as texture coordinates.


Color register:

Used to pass data from the vertex shader to the pixel shader.


Details information

Read Limit:

The read port limit specifies the number of different registers of each register type that can be used as a source register in a single instruction.


Read-Only and Read/Write:

Register types are identified by their Read-Only or Read/Write capabilities. Read-only registers can only be used as source registers in an instruction; they can never be used as a destination register.


Range:

The range is the maximum and minimum value of the register data. The ranges vary depending on the register type.

Early pixel shader hardware represented the data in registers using fixed-point numbers. This limits the precision to a maximum of about eight bits for the fractional part of the number.

Created with the Personal Edition of HelpNDoc: Enhance Your Documentation with HelpNDoc's Advanced Project Analyzer