Instead, treat the entire sequence from glBegin..glEnd as a single drawing
operation and execute the timer query around the whole thing.
TIMED_DEFER (glClear, mask);
}
TIMED_DEFER (glClear, mask);
}
+/* We can't just use TIMED_DEFER for glBegin/glEnd since the
+ * glBeginQuery/glEndQuery calls must both be outside
+ * glBegin/glEnd. */
+void
+glBegin (GLenum mode)
+{
+ if (! inside_new_list)
+ {
+ unsigned counter;
+ counter = metrics_add_counter ();
+ glBeginQuery (GL_TIME_ELAPSED, counter);
+ }
+
+ GLWRAP_DEFER (glBegin, mode);
+}
+
+ GLWRAP_DEFER (glEnd);
+
+ if (! inside_new_list) {
+ glEndQuery (GL_TIME_ELAPSED);
+ }
glCallList;
glCallLists;
glClear;
glCallList;
glCallLists;
glClear;
glEnd;
glDrawPixels;
glBlitFramebuffer;
glEnd;
glDrawPixels;
glBlitFramebuffer;