1. Input assembler (IA) Stage
The primary task of the IA stage phase is to read the vertex and index data from memory, and assemble the vertex and index data into a collection entity.
The assembly format for vertices is determined by specifying the element topology for the vertices (Primitive topology). Primitive topology has the following main types: Point list, line Strip, line list, Triangle list, Triangle Strip, primitives with Adjaceny, Control Point Patch List.
To solve the problem of frequent use of duplicate vertices in the assembly of elements, we introduce the concept of vertex indexing. The reason for using an index instead of repeating vertices is that: 1, using vertices increases memory consumption, and because the indexes are simple integers, the use of Struct Vertex significantly reduces memory footprint. 2. If a good vertex cache order is used, the video card does not have to handle a large number of duplicate vertices frequently.
2, Vertex Shader (VS) Stage
The vertex is fed into the vertex shader (Vertex Shader) after the first stage of the element is assembled. The vertex shader resembles a function that processes each vertex (for example: transformations, lighting, displacement mappings, etc.) and then outputs the vertices after processing. Similar to:
for (UINT i = 0;i<numvertices;++i) outputvertex[i] = VertexShader (Inputvertex[i]);
Since the above processing is done in the GPU, it is fast.
3. The tessellation Stage
Tessellation is a triangle that subdivides a mesh, creating a new triangle. These triangles can be cheaper to new locations in order to create finer mesh detail.
Tessellation has the following three benefits:
1. LOD (level of detail) mechanism can be achieved
2, we can save only a small number of triangles (low-poly), and then in the actual display, through the tessellation, add additional triangles, so that the memory is saved.
3, we can use the low density grid (Low-poly) when animating or physical operation, and use the high density grid when rendering.
4. Geometry Shader Stage
The advantage of geometry shaders is that you can create or destroy elements. For example, an input entity can be extended to one or more other entities, or it can be selected to output an entity based on a certain condition. An example of using a geometry shader is that we can extend a point or a line into an area.
5, Clipping
The parts outside the cones can be completely ignored, while the parts that intersect the cones need to be cut, leaving only the parts of the cones inside.
6. The Rasterization Stage
The raster phase calculates the color of each pixel in the triangle.
The rasterization phase has three parts: palatability transformation, back pick, and vertex difference.
7. The Pixel Shader Stage
A pixel shader is a program that executes on the GPU. The pixel shader evaluates each pixel with the attributes of the vertices as input, and eventually outputs a color value. Pixel shaders can be as simple as outputting a single color, or complex to implement the PPL (per-pixel light), reflection, shadow effects and other techniques.
8. The Output merger Stage
After pixel shaders generate pixel fragments, they are moved to the OM (Output merger) stage of the render pipeline. At this stage, some pixel fragments may be discarded (not through depth or template testing), while the remainder are written to the cache. Mixing (Blending) is also done at this stage.
D3D11 Game Programming Rendering pipeline