● Learn about GPU graphics pipeline from mountain level rendering
In this section, I will explore GPU rendering steps with most GPU enthusiasts who are familiar with it. We will use the rendering process of a mountain to help you understand the working principles of the GPU graphics pipeline. To put it simply, the GPU mainly completes processing 3D graphics-generating and rendering of graphics.
View GPU graphics pipeline from mountain level rendering
1. vertex generation
Graphics API (ApplicationProgramInterface) uses the initial elements (points, lines, and triangles) to represent the object surface. In addition to the three-dimensional coordinate attributes (x, y, z), each vertex also has application-defined attributes, such as location, color, and standard vector. In combination with the mountain we see, the GPU first reads the vertex data describing the 3D appearance of the mountain from the video memory.
2. vertex Processing
In this phase, the GPU reads the vertex data describing the appearance of a 3D image, determines the shape and position of the 3D image based on the vertex data, and establishes the skeleton of the 3D image. In GPUs supporting dx8 and DX9 specifications, these tasks are completed by the hardware-implemented vertex shader. In this phase, the GPU generates a batch of vertices that reflect the position and direction of the mountain triangle scene.
3. Raster computing
The actual display of the display is composed of pixels. We need to pass the points and lines on the image generated above through a certainAlgorithmConvert to the corresponding pixel. The process of converting a vector image into a series of pixels is called grating. For example, a mathematical diagonal line segment is eventually converted into a tiered continuous pixel.
After the mountain vertices are generated in the screen space, These vertices are divided into triangle elements. fixed units in the GPU raster these mountain elements, and the corresponding pieces of metadata are also generated.
GPU internal rendering pipeline
4. Texture posts
The polygon generated by the vertex unit only forms the contour of a 3D object, while the texture mapping (texture mapping) completes the post graph of the Multi-deformation surface, it is to paste the corresponding image on the surface of the polygon to generate a "real" image. TMU (Texture Mapping Unit) is used to complete this task.
5. pixel Processing
In this phase (during Rasterization of each pixel), the GPU completes pixel computing and processing to determine the final attribute of each pixel. In GPUs that support dx8 and DX9 specifications, these tasks are completed by the hardware-implemented pixel shader.
Pixel operations use the screen coordinates of each element to calculate the effect of the element on the pixels of the final generated image. In this phase, pixel shader reads texture data from the video memory to color and render the mountain fragment.
6. Final output:
The drop (raster engine) completes pixel output. After one frame is rendered, it is sent to the buffer zone of the video storage frame. AA is multiple sampling, which puts a considerable pressure on the performance of the ROP and the bandwidth of the graphics card. The filtering of different types of objects brings more burden to TMU.
In this phase, the drop Object Unit outputs all the mountain pixels to the frame buffer zone, and the data in the frame buffer zone is output to the display after the D/A conversion, we can see the successfully drawn mountain image.