什么是render pass?render pass 和drawcall 的区别
备份下
I'm currently trying to learn to use uniform buffers and instanced rendering.
I know the concept of both, but in each Tutorial I read the term "renderpass" or "draw-call" comes up.
Can someone explain to me what that means in Programming terms? is it each time and individual object, Mesh is drawn?
is it each time a shader is executed?
So what exactly is a renderpass? Is it the same as a draw call?
Is it maybe basicly this?:
Gl_Color(xyz);
gl_uniform("a",1);
gl_uniform("a",1);
gl_uniform("a",1);
//I know this is deprected as balls, but just to help me understand
Gl_Begin(GL_VERTEX_STRIP);
GL_Vertex(xyz);
GL_TEXCOORD(xy);
GL_End();
Answer:
The term "Draw call" means exactly what it says: calling any OpenGL function of the form gl*Draw*
. These commands cause vertices to be rendered, and kick off the entire OpenGL rendering pipeline.
So if you're drawing 5000 instances with a single glDrawElementsInstanced
call, that's still just one draw call.
The term "render pass" is more nebulous. The most common meaning refers to multipass rendering techniques.
In multipass techniques, you render the same "object" multiple times, with each rendering of the object doing a separate computation that gets accumulated into the final value. Each rendering of the object with a particular set of state is called a "pass" or "render pass".
Note that a render pass is not necessarily a draw call. Objects could require multiple draw calls to render. While this is typically slower than making a single draw call, it may be necessary for various reasons.
Techniques like this are generally how forward rendering works with multiple lights. Shaders would typically be designed to only handle a single light. So to render multiple lights on an object, you render the object multiple times, changing the light characteristics to the next light that affects the object. Each pass therefore represents a single light.
Multipass rendering over objects is going out of style with the advent of more powerful hardware and deferred rendering techniques. Though deferred rendering does make multiple passes itself; it's just usually over the screen rather than individual objects.
This is only one definition of "render pass". Depending on the context, the tutorial you're looking at could be talking about something else.
share improve this answer follow
answered Dec 20 '15 at 18:42
345k4646 gold badges585585 silver badges771771 bronze badges
-
So basicly a draw call is the render of one or one set meshes with the same shader and the same shader paramters including transformation Matrix? – user2741831 Dec 21 '15 at 0:02
-
@user2741831: Yes, but only in the sense that all vertices sent in a draw call will use the same shader and overall rendering state. You can issue multiple draw calls back-to-back without changing state between them. They are still multiple draw calls, even though you don't change any rendering state between them. – Nicol Bolas Dec 21 '15 at 0:04