The most significant part of the geometric module is the Vertex Processing Unit.
This part can also carry the following denominations:
- Vertex Shader Unit
- Vertex Shader Processor
- Vertex Shader Engine
- Vertex Shader Core
This part represents the first source of confusion. We hear the terms vertex shader, vertex processor,
vertex pipeline - but what does this all really mean?
The Vertex Processing Unit is the processing unit which acts on the vertices. A vertex is simply a "corner"
(the point at which the sides of an angle intersect) which can have different number of attributes, according to the
needs of the 3D developer. Some current examples are: position, normal vector, textures coordinates and color
for the most significant vertex attributes. Each one of these attributes is represented by a vector: 4D vector
(homogeneous coordinates) for the position, 3D vector for the normals, 2|3|4D vector for the textures coordinates,
4D vector for the colors. Each 3D object consists of a set of vertices which make it possible to define its shape
(position attribute), the way in which the texture is applied to the surface of the object (texture coordinates attribute)
or the way in which light interacts with the object (normal vector attribute).
The Vertex Processing Unit (as well as the Fragment Processing Unit which we will examine later in this text) is
an extremely parallel processing unit. This unit works according to the SIMD principle: Single Instruction
Multiple Data. In simple terms this means that the same succession of operations can be applied simultaneously to
several data. The Vertex Processing Unit is composed of multiple execution units called Vertex Pipelines.
Instead of the Pipeline Vertex, you can also find the following denominations:
- Vertex Processor
- Vertex Engine
- Vertex Pipe
These Vertex Pipelines make it possible to realize the SIMD Principle: each one of these vertex pipelines
performs the same sequence of instructions on different vertices at the same time.
It is this multiplication of execution units that provides the GPU with a superior computing power compared to that
of a traditional CPU. A GPU is a processor specialized in processing graphics. Being specialized, the GPU is able to
reserve most of its transistors to handle both calculation functions as well as the execution of identical units in
vast quantities.
The Vertex Pipeline is the first information found on the technical/advertising documents of the following graphic
boards:
- nVidia Geforce 7950 GX2: 2*8 vertex pipelines
- nVidia Geforce 7900 GTX: 8 vertex pipelines
- ATI Radeon 1950 XTX: 8 vertex pipelines
- ATI Radeon 1900 XTX: 8 vertex pipelines
The sequence of instructions executed by a Vertex Pipeline is called a Vertex Shader. We also encounter the
name of Vertex Program. Therefore, when in some websites or documents it is written: GPU with 8 vertex shaders, we
now understand that this is incorrect. It should instead read: GPU with 8 vertex pipelines.
A Vertex Shader is a program written by using one of the following languages (called shading language):
- the Assembler: low level shading language (available for OpenGL and Direct3D)
- the Cg: high level shading language for nVidia (C for Graphics Programming)
- the HLSL: high level shading language of Microsoft for Direct3D
- the GLSL: high level shading language for OpenGL
It is interesting to note that CG and HLSL were developed jointly between nVidia and Microsoft.
Currently the tendency is to use the high level shading languages to code the vertex shaders. They are easier to learn, are
read and maintained better and offer a level of performance more or less equivalent to that of the low level shading
languages which will eventually likely no longer be used. Due to the increasing complexity of GPUs, it is becoming
very difficult to optimize the shaders by hand as it is necessary to take into account more and more parameters.
It is therefore advised to leave this harassing work to the shading language compiler. And this is even more evident
for a shader intended for the fragments processing unit!
Just to clarify, here is an example of vertex shader written in GLSL:
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
This is the simplest of the vertex shaders: the entry position, materialized by gl_Vertex is multiplied by the
gl_ModelViewProjectionMatrix transformation matrix in order to give the final position of the vertex necessary to the
rasterisation module.
For more complex examples of vertex shader, see the following tutorials: