About Draw Call

According to illustrate the 3W rule Draw Call

 

What? (What is Draw Call)

 

Draw Call is the CPU calls a graphical programming interface, such as DirectX or OpenGL, GPU commands to operate rendering.

For example, DirectX in DrawIndexedPrimitive command, OpenGL in glDrawElement command.

Can also be said, in Unity, each engine ready to process the data and inform the GPU called a Draw Call.

For CPU and GPU can work in parallel, you need a command buffer (Command Buffer)

The command buffer includes a command queue, the command added thereto by a CPU, and a read command from GPU. Read and add processes are independent of each other, so that the command buffer can be operated independently of the CPU and GPU. When the CPU needs to render some objects, it can add commands to a command buffer, while the GPU complete after the last rendering tasks, it can remove a command from the command queue and execute it.

Command in the command buffer there are many types, and Draw Call is one of them.

 

Why? (Why Draw Call affect performance)

 

Before calling the Draw Call CPU needs to put a lot of data is ready, the vertex of the object (including local position, normal, UV, etc.), index (how to make up the triangle vertices), conversion (that is, the position of objects, rotate, zoom, and camera position etc.), related to the light source, texture, rendering (/ Shader determined by the material) and the like data. At this stage, CPU needs to be done a lot of work, such as checking the rendering status. Once completed these preparations CPU, GPU can begin this rendering. GPU rendering capability is very strong, often rendering speed faster than the speed of the CPU commit command. If too many of Draw Call, CPU will put a lot of time spent on submitting Draw Call command, causing overload the CPU. Therefore Draw Call culprit causing performance problems of a CPU. Draw Call the number of calls is to determine the more important indicators of performance.

 

 

How? (How to reduce the number of Draw Call)


Dynamic Batching to provide technical and Static Batching in Unity

https://gameinstitute.qq.com/community/detail/113040

https://gameinstitute.qq.com/community/detail/114323

 

 

 

 

Reference: https://www.jianshu.com/p/061b84e4f863

Guess you like

Origin blog.csdn.net/iov3Rain/article/details/95043926