[每日Shader]DirectX.9.Programmable.Graphics.Pipeline[一]
Posted on 2008-11-10 22:06 活着就是幸福 阅读(428) 评论(0) 编辑 收藏 举报Virtual Machine Block Diagram
1. Each register contains four floating-point values.
2. ■ Input registers read from the vertex buffer
■ Constant registers provide constants to the ALU
■ Temporary registers are like temporary shader variables
■ Output registers contain the shader results
Shader Layout
■ A version instruction
■ Comments
■ Constants
■ Input register declarations
■ Instructions
Sample:
1. A version instruction must be the first instruction in any shader.
2. Constants can be assembled into shader code with the def instruction.
These constants are read-only by the shader.
3. Each register can hold up to four values.
4. Vertex shader input registers are different from constant registers
in that they need to be declared before they're used. The declaration
is required because it binds a shader input register with its corresponding
vertex buffer component. When the vertex shader runs, the vertex buffer data
is streamed into the vertex shader input register named in the input register
declaration.
5. Instruction types: flow-control, arithmetic, texture, and macro-ops.
6. Every vertex shader must write to the position register, or it will fail validation
when it's assembled. The only exception is when an application calls
ProcessVertices to apply a vertex shader to a set of vertices, and return the
results in a vertex buffer. In this case, no rendering is done.
-----------------------------------------------------------
每天进步一点