?/TD> |
Microsoft DirectX 9.0 |
Vertex shader temporary register. A temporary register is used to hold 4-D intermediate results.
Syntax
Temporary Register
Remarks
Remarks
Vertex shader versions 1_1 2_0 2_sw 2_x 3_0 3_sw Temporary Register x x x x x A register consists of properties that determine how each register behaves.
Property Description Name r[n] - n is an optional register number. 0 is the default value used, if it is omitted. Count A maximum of 12 registers. I/O permissions read/write. This register can be read or written by the application programming interface (API) or by the shader. Read ports 3. 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 // xzIn 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 system Windows 98