Real-Time Shader Programming

TEMPORARY REGISTERS

r[n]: The Temporary Registers

The temporary registers can be used to hold anything you want in a pixel shader.

Temporary registers are considered uninitialized when a vertex shader is first loaded, and an attempt to assemble a shader that fails to initialize a temporary register before using it will fail validation (Table 8.6).

Table 8.6: Temporary Register Properties

PS VERSION

1.0

1.1

1.2

1.3

1.4

2.0

NUMBER

2

2

2

2

6

12

PORT LIMITS

2

2

3

3

3

3

READ/WRITE?

RW

RW

RW

RW

RW

RW

RANGE

Max

Max

Max

Max

Max

16- or 32-

Pixel-

Pixel-

Pixel-

Pixel-

Pixel-

bit float

Shader

Shader

Shader

Shader

Shader

precision

Value

Value

Value

Value

Value

The r0 register is a special case, and all pixel shaders except PS 2.0 must write r0 as the final color of the pixel that is being rendered. PS 2.0 has added specific output registers.

The r5. r and .g register elements are used as output if you used the texdepth instruction.

Note

Since texture registers are read/write (except in PS 1.0, 1.4, and PS 2.0), you are free to use unused (or no longer needed) texture coordinate registers as extra temporary registers.

s[n]: The Texture Sampling Stage Registers

The DirectX 9 pixel shader 2.0 model separated the texture registers into texture coordinate registers and texture sample stage registers. A sampling stage register identifies a sampling unit that can be used in...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Shift Registers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.