glMultiDrawElements + Query


For hardware query occlusion could be very useful something like this.

void glMultiDrawElementsQuery( 
GLenum mode,
const GLsizei* count,
GLenum type,
const GLvoid ** indices,
GLsizei primcount
GLenum target,   // The target type of query object
GLuint* id          // A pointer to a array of ids.

Given a huge VBO and IBO, we need to made a query and a draw call for each geometry chunk we want to check. The new method could dramatically reduce function call overhead compared with the actual way.

glMultiDrawElementsQuery could have the same effect as:

        for ( int i = 0; i < size; i++)
            glBeginQuery( GL_SAMPLES_PASSED, queries[i] );
            glDrawElements (mode, count[i], type, offset[i] );
            glEndQuery( GL_SAMPLES_PASSED );