I know I can use QueryPerformanceCounter
for measure time for whole single frame. But can I when it comes to OpenGL draw or compute call?
I always assumed that, as on the diagram, CPU waits for GPU to finish so timer would measure approximate time or am I wrong?
As seen in code:
glBindVertexArray(vertexArrayObject);
timer->startCounter();
glDrawElements(GL_TRIANGLE_STRIP, indices.size(), GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
estimatedRenderTime = timer->getCounter();
or
timer->startCounter();
glDispatchCompute(width, height, 1);
estimatedRenderTime = timer->getCounter();