-/* Execute a glBegineQuery/glEndQuery pair around an OpenGL call. */
-#define TIMED_DEFER(function,...) do { \
- unsigned counter; \
- counter = metrics_add_counter (); \
- glBeginQuery (GL_TIME_ELAPSED, counter); \
- GLWRAP_DEFER(function, __VA_ARGS__); \
- glEndQuery (GL_TIME_ELAPSED); \
+/* Execute a glBeginQuery/glEndQuery pair around an OpenGL call. */
+#define TIMED_DEFER(function,...) do { \
+ if (! inside_new_list) { \
+ unsigned counter; \
+ counter = metrics_add_counter (); \
+ glBeginQuery (GL_TIME_ELAPSED, counter); \
+ } \
+ GLWRAP_DEFER(function, __VA_ARGS__); \
+ if (! inside_new_list) { \
+ glEndQuery (GL_TIME_ELAPSED); \
+ } \