ps_1_X Registers
Microsoft DirectX 9.0 SDK Update (October 2004)

ps_1_X Registers


Pixel shaders depend on registers to get vertex data, to output pixel data, to hold temporary results during calculations and to identify texture sampling stages. There are several types of registers, each with a unique functionality. This section contains reference information for the input and output registers implemented by pixel shader version 1_X.

Registers hold data for use by the pixel shader. Registers are fully described in the following sections.

Register Types

Versions
Name Type 1_1 1_2 1_3 1_4
c# Constant register 8 8 8 8
r# Temporary register 2 2 2 6
t# Texture register 4 4 4 6
v# Color register 2 2 2 2 in phase 2

Read Port 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.

Versions
Name Type 1_1 1_2 1_3 1_4
c# Constant register 2 2 2 2
r# Temporary register 2 2 2 3
t# Texture register 2 3 3 1
v# Color register 2 2 2 2 in phase 2

For example, the color registers for almost all versions have a read port limit of two. This means that a single instruction can use a maximum of two different color registers (v0 and v1 for instance) as source registers. This example shows two color registers being used in the same instruction:

mad r0, v1, c2, v0

Read-only, Read/Write

The register types are identified according to read-only (RO) capability or read/write (RW) capability in the following table. Read-only registers can be used only as source registers in an instruction; they can never be used as a destination register.

Versions
Name Type 1_1 1_2 1_3 1_4
c# Constant register RO RO RO RO
r# Temporary register RW RW RW RW
t# Texture register RW RW RW See following note
v# Color register RO RO RO RO

Registers that are RW capable can be used to store intermediate results. This includes the temporary registers and texture registers for some of the shader versions.

Note  

Range

The range is the maximum and minimum register data value. The ranges vary based on the type of register. The ranges for some of the registers can be queried from the device caps using IDirect3D9::GetDeviceCaps.

Name Type Range Versions
c# Constant register -1 to +1 All versions
r# Temporary register - PixelShader1xMaxValue to + PixelShader1xMaxValue All versions
t# Texture register - MaxTextureRepeat to + MaxTextureRepeat All versions
v# Color register 0 to 1 All versions

Early pixel shader hardware represents data in registers using a fixed-point number. This limits precision to a maximum of approximately eight bits for the fractional part of a number. Keep this in mind when designing a shader.

For pixel shader version 1_1 to 1_3, MaxTextureRepeat must be a minimum of one. For 1_4, MaxTextureRepeat must be a minimum of eight.

See D3DCAPS9 for more information about PixelShader1xMaxValue.



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.