PDA

View Full Version : Primitive restart vs multi-draw calls?



Prune
04-26-2010, 02:29 PM
Is primitive restart faster than glMultiDraw{Elements|Arrays|ArraysBaseVertex}? I assume the multi-draw calls loop in the driver. However, I read this in the 3.3 spec:
"Because client enable/disable no longer exists in OpenGL 3.1, the PRIMITIVE RESTART state has become server state, unlike the Nvidia extension where it is client state."
Does server state indicate this is completely handled by the GPU? Thus there won't be multiple synchronization points and it's really a single call by the driver? (note: I'm targeting GTX285 cards specifically as I'm writing code for kiosks with identical hardware specs)

BTW, I've been unable to get the multidraw to work right with element buffers. I thought that, as with glDrawElements, the indices are treated as offsets if an element buffer object is used. Thus, if I have a VBO with cube vertices, and and element buffer bound, then glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, 0); should give me the same result as
GLsizei counts[] = {4, 4, 4, 4, 4, 4};
GLuint offsets[] = {0, 4, 8, 12, 16, 20};
glMultiDrawElements(GL_QUADS, counts, GL_UNSIGNED_INT, (const GLvoid **)offsets, 6);
However, I get nonsense rendering from the latter. How do I get it to work with VBOs? (or I might not bother if restart primitive is faster)

Prune
04-28-2010, 11:43 AM
Still hoping for comment...

AlexN
04-28-2010, 03:15 PM
Primitive restart should be faster. But, are you sure you need it? It's only useful for quad, triangle, or line strips, I believe... And, the typical usage of putting multiple triangle strips into a single draw call can be achieved using degenerate triangles, instead of primitive restart.