I just went after possibilities to reduce draw call numbers and cost but yes, driver overhead comes into play too. To go with the example i used: when you could instruct the gpu to draw an entire tile of grass with only one draw call instead of dozens(?) you need to call less routines which reduces overhead.
In fact, there's no technical difference between DX and OpenGL on draw calls. For example:
DX
Code: Select all
HRESULT DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
OpenGL
Code: Select all
void glDrawArrays(GLenum mode, GLint first, GLsizei count);
As you see, the draw calls are identical. There can be some limits like the total number of vertices but to my experience are driver-specific or non-exist. Some GPUs can render tens of thousands triangles
in just one call with the above functions while some other can render less.
One rule of thumb i found is to try and pack at least 100 triangles / draw comamnd, having the same
state etc. same texture, same colors, same transparency whatever.
The real performance killer comes from drawing 1,2 or 5 trianges by a single draw command as above. If your scene has thousands of triangles that translates to hundreds of DX/OpenGL commands, which in turn
may or may not be optimized by driver. Combine that with a consuming shader and you have just killed the performance.
One can get a
massive performance just by packing hunders of triangles using the same texture, thus sending far less commands to the driver -> GPU. I don't know about the grass effect but certainly
terrains are very demanding in this kind of issue.
@petri, i had a performance problem as well to my OGL rendered in OSX. For some reason, OSX driver was always set my renderer to software. Apple drivers have a software revert for everything that doesn't supported in hardware but there's no easy way to know about

My solution was to add the following to my list of OpenGL context format attributes (Cocoa):
Code: Select all
NSOpenGLPixelFormatAttribute formatAttrib[] = {
...
NSOpenGLPFAAccelerated, // <-- that forces the Apple drivers to NOT revert to software renderer
...
};
...
More info
here.