?/TD>
Microsoft DirectX 9.0

Temporary Register


Vertex shader temporary register. A temporary register is used to hold 4-D intermediate results.

Syntax

Temporary Register 

Remarks

Remarks
Vertex shader versions1_12_02_sw2_x3_03_sw
Temporary Registerxxxxx

A register consists of properties that determine how each register behaves.

PropertyDescription
Namer[n] - n is an optional register number. 0 is the default value used, if it is omitted.
CountA maximum of 12 registers.
I/O permissionsread/write. This register can be read or written by the application programming interface (API) or by the shader.
Read ports3. This is the number of times a register can be read within a single instruction. A temporary register is the only register that can be read and written more than once in a single instruction.

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Ž API call to create the vertex shader.

Example

Here is an example using a temporary register r0. Constant registers do not get declared, so jump directly to the shader code that uses them.

// Decompress position
mov r0.x, v0.x
mov r0.y, c4.w       // 1
mov r0.z, v0.y
mov r0.w, c4.w       // 1

// Compute theta from distance and time
mov r4.xz, r0        // xz

In this example, the shader writes vertex data (v0) and constant data (c4) into r0. The data is later read into temporary register r4 to help compute an angle theta. The constant register (c4) must either be initialized in shader code, or set by the API.

For a more complete code sample, see the VertexShader software development kit (SDK) sample.

Instruction Information

Minimum operating systemWindows 98


© 2002 Microsoft Corporation. All rights reserved.