libframetime icon indicating copy to clipboard operation
libframetime copied to clipboard

Add support for OpenGL timer queries

Open Eliasvan opened this issue 8 years ago • 0 comments

As discussed in #6, adding support for OpenGL timer queries to libframetime is highly desirable because of accuracy improvements. This pull request takes care of that.

This new measuring method will by used by default when available at compiletime AND at runtime. This can be overruled at runtime by setting the LIBFRAMETIME_TIMERQUERIES_DISABLED=1 environment variable. If, for some reason, the timer query approach fails at init, graceful degradation ensures libframetime will continue with the original cpu timer approach. The README is updated to document this new functionality. To verify timer queries are used, set the LIBFRAMETIME_TIMERQUERIES_DEBUG=1 environment variable and check whether the following line is printed:

libframetime: Number of bits of timer query counters: 

This was tested with Mesa on Ivybridge (X11 (GL) and Wayland (EGL)), Skylake (X11), GTX760 (X11) and on Skylake (X11) when GL_ARB_timer_query was explicitly #undef-ed at compiletime (in which case it correctly used the cpu timer instead).

This pull request builds upon the feature-ImprovedErrorHandlingAndCodeCleanupV3 branch, and only adds one new commit.

Because of the added functionality is significant w.r.t. the original functionality, I added my name in the copyright notice. If you don't agree, please let me know and I'll remove it.

Eliasvan avatar Nov 15 '16 21:11 Eliasvan