Microsoft DirectX 8.1 (Visual Basic) |
When in operation, a programmable vertex shader replaces the transformation and lighting module in the Microsoft® Direct3D® geometry pipeline. In effect, state information regarding transformation and lighting operations are ignored. However, when the vertex shader is disabled and fixed function processing is returned, all current state settings apply.
Any tessellation of high-order primitives should be done before execution of the vertex shader. Implementations that perform surface tessellation after the shader processing must do so in a way that is not apparent to the application and shader code. Because no semantic information is normally provided before the shader, a special token is used to identify which input stream component represents the base position relative to which all other components are interpolated. No noninterpolable data channels are supported.
On output, the vertex shader must generate vertex positions in homogeneous clip space. Additional data that can be generated includes texture coordinates, colors, fog factors and so on.
The standard graphics pipeline processes the vertices output by the shader, including the following tasks.
Note that the clipping space for DirectX 8.x vertex shaders is the same as for DirectX 7.0 and DirectX 8.x fixed function vertex processing. For details, see Clipping Volumes.
Programmable geometry is a mode within the Direct3D application programming interface (API). When it is enabled, it partially replaces the vertex pipeline. When it is disabled, the API has normal control—operating as in DirectX 6.0 and 7.0. Execution of vertex shaders does not change the internal Direct3D state, and no Direct3D state is available for shaders.
Calling Direct3DDevice8.CreateVertexShader with the FunctionTokenArray parameter equal to ByVal 0, is used to create a shader for the fixed-function pipeline. When FunctionTokenArray is not ByVal 0, the shader is programmable. A call to Direct3DDevice8.SetVertexShader sets the current active shader, which defines whether the rendering pipeline should use programmable or fixed-function vertex processing.