?/TD>
Microsoft DirectX 9.0

Input Registers


Address Register - a0

The a0 registers are the address registers. A single register is available in version 1_1. The address register, designated as a0.x, can be used as a signed integer offset for relative addressing into the constant register file.

c[a0.x + n]

Reads from out of the legal range will return (0.0, 0.0, 0.0, 0.0). Address registers can be a destination only for the mov instruction. Address registers cannot be read by the vertex shader, just used in relative addressing of the constant register file. Addresses read from outside the range of constant registers supported will return unpredictable results.

Version 1_1 vertex shaders that attempt to use the address register before setting it will also fail.

Vertex shader versions1_12_02_sw2_x3_03_sw
Address Registerxxxxxx

Constant Register - cn

The cn registers are the constant registers. There are at least 96 four-component floating-point vectors comprising the constant register file. The constant registers are designated as either absolute or relative.

c[n]           ; absolute
c[a0.x + n]    ; relative - supported only in version 1_1

The constant register can be read, therefore, by using an absolute address, or addressed relative to an address register. Reads from out-of-range registers return (0.0, 0.0, 0.0, 0.0).

The constant register file is read-only from the perspective of the vertex shader. Any single instruction may access only one constant register. However, each source in that instruction may independently swizzle and negate that vector as it is read.

The MaxVertexShaderConst member of D3DCAPS8 indicates the number of available constant registers. As shown in the table, vertex shaders support at least 96 constant registers.

The constant register file has its data loaded by calling the IDirect3DDevice8::SetVertexShaderConstant. Alternatively, when creating a vertex shader, a user can declare constants in a vertex declaration. These constants are loaded every time IDirect3DDevice8::SetVertexShader is called.

Vertex shader versions1_12_02_sw2_x3_03_sw
Constant Registerxxxxxx

Position Registers - vn

The vn registers are the input vertex registers. Each vertex from one or more input vertex streams is loaded into the vertex input registers before the vertex shader is run. The vertex input registers are a register file consisting of 16 four-component floating-point vectors, designated as v0 through v15. These registers are read-only.

Any single instruction can access only one vertex input register. However, each source in the instruction can independently swizzle and negate that vector as it is read.

A programmable vertex shader can use up to 16 registers for vertex data.

Vertex shader versions1_12_02_sw2_x3_03_sw
Position Registerxxxxxx

Temporary Registers - rn

The rn registers are the temporary registers. The temporary registers are grouped into a file of 12 4-D floating point vectors. Each temporary register has single-write and triple-read access. Therefore, an instruction can have as many as three temporary registers in its set of input source operands.

No values in a temporary register that remain from preceding invocations of the vertex shader can be used. Vertex shaders that read a value from a temporary register before writing to it will fail the Microsoft?Direct3DŽ  application programming interface (API) call to create the vertex shader.

Vertex shader versions1_12_02_sw2_x3_03_sw
Temporary Registerxxxxxx


© 2002 Microsoft Corporation. All rights reserved.