?/TD>
Microsoft DirectX 9.0

Registers - ps_1_X


Pixel shaders depend on registers to get vertex data, to output pixel data to the rasterizer, 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
cn Constant register 8 8 8 8
rn Temporary register 2 2 2 6
tn Texture register 4 4 4 6
vn 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
cn Constant register 2 2 2 2
rn Temporary register 2 2 2 3
tn Texture register 2 3 3 1
vn 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.

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
cn Constant register RO RO RO RO
rn Temporary register RW RW RW RW
tn Texture register See following note RW RW RW
vn 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 GetDeviceCaps.

Name Type Range Versions
cn Constant register -1 to +1 All versions
rn Temporary register - MaxPixelShaderValue to + MaxPixelShaderValue All versions
tn Texture register - MaxPixelShaderValue to + MaxPixelShaderValue 1_1 to 1_3
tn Texture register - MaxTextureRepeat to + MaxTextureRepeat 1_4
vn Color register 1_4

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.



© 2002 Microsoft Corporation. All rights reserved.