What exactly is a GPU card for?

Before GPU appeared, the relationship between graphics card and CPU was a bit like "master-servant relationship". Simply put, the graphics card at this time is a painting brush, which colors, fills, renders and outputs materials according to various instructions and data issued by the CPU.

Early entertainment 3D graphics cards were also called "3D accelerator cards". Because most of the coordinate processing work and light and shadow special effects need to be handled by the CPU, it takes up too much calculation time of the CPU, which leads to the inability to display the whole picture very smoothly.

For example, to render a complex 3D scene, it is necessary to process tens of millions of triangle vertices and rasterize billions of pixels in one second. In the early 3D games, the graphics card only provided a buffer for the pixels displayed on the screen, and all the graphics processing was done by the CPU alone. Graphics rendering is suitable for parallel processing, but CPU, which is good at serial work, is not competent for this task. So the three-dimensional image generated in real time on PC was very rough. But in a sense, the graphics drawing at that time was completely programmable, but the CPU was responsible for this important task, and the speed really could not meet the requirements.

With the passage of time, the speed of CPU's various light and shadow operations has become increasingly unable to meet the requirements of game developers. The application of more polygons and special effects drained almost all CPU performance, and contradictions arose. ...

The birth of GPU

NVIDIA put forward the concept of GPU for the first time when it released GeForce 256 graphics processing chip on August 3rd1,1999.

GPU is called graphics processor mainly because it can perform almost all data operations related to computer graphics, which was previously the patent of CPU.

At present, computer graphics is in an unprecedented development period. In recent years, GPU technology is developing at an alarming rate. The rendering speed doubles every six months. Since 1999, the performance of these years has increased by 10 times 100 times, that is, (the second power of 10) has increased by thousands of times! At the same time, it not only improves the performance, but also gradually improves the calculation quality and the flexibility of graphic programming.

In the past, PCs and computer workstations only had graphics accelerators, and there was no graphics processor (GPU). Graphics accelerators could only simply speed up graphics rendering. After GPU replaces graphics accelerator, we should abandon the old concept of graphics accelerator.

GPU architecture

The full name of GPU is graphics processing unit-graphics processor, and its biggest function is to perform various operations needed for drawing computer graphics, including vertex setting, light and shadow, pixel operation and so on. GPU is actually a set of graphics functions, which are realized by hardware. In the past, these tasks were all completed by CPU with specific software, and GPU played a leading role in graphics processing in a sense.

A simple GPU structure diagram contains a standard GPU, including 2D engine, 3D engine, video processing engine, FSAA engine and memory management unit. Among them, 3DEngine plays an important role in 3D computing. It is the soul of modern 3D graphics cards and an important symbol to distinguish the level of GPU. 3DEnglne is the key care object in the publicity campaign of various companies, and its name is getting louder and louder, such as NVIDIA's nFjnjtFX series, CineFX series and AMD's SmoothVision series. A 3d engine usually contains t &;; L unit, VertexProeessingEngine, SetupEngine, PiexlShader, etc.

Working principle of GPU

Data processing flow in GPU

Now let's take a look at how the second generation GPU completely processes a picture! First of all, various physical parameters from CPU enter the GPU, and the vertex shader will make a basic judgment on the vertex data. If there is no vertex effect to be processed, the vertex data will directly enter T &;; The l unit executes the traditional t&; L save time and improve efficiency. If you need to deal with various vertex effects, the vertex shader will first calculate the instructions of various vertex programs. Generally speaking, vertex programs often contain T & ampl effects that need to be realized in the past, such as transformation, cropping and lighting operations, so vertex shaders generally do not need T & AMPL operations to process the effects. In addition, when it comes to surface tessellation (converting surfaces, such as arches, into polygons or triangles). CPU can directly hand over data to vertex shader for processing.

In addition, in the transformation process of DireetX, vertex shader can complete the elimination of Z value, that is, back elimination-hidden face. This means that in addition to the vertices outside the visual field, the vertices covered by the slope points in the visual field will also be cut off, which greatly reduces the number of vertices that need to be operated.

Next, all kinds of data processed by VertexShader will flow into SetupEngine, where the arithmetic unit will set triangles, which is the most important step in the whole drawing process. Setting the engine even directly affects the execution efficiency of GPU. The triangle setting process consists of polygons, or a better triangle is used to replace the original triangle. In the 3D image, some triangles may be obscured by the triangle in front of it, but at this stage, the 3D chip does not know which triangles will be obscured, so the triangle construction unit receives a complete triangle composed of three vertices. Each corner (or vertex) of a triangle has corresponding coordinate values of X-axis, Y-axis and Z-axis, which determine their positions in the 3D scene. At the same time, the setting of triangle also determines the range of pixel filling. At this point, VertexShader's work is completed.