memononen/nanovg — pull request #31 by dougbinks (2014-02-18 14:50:51+00:00)
Title: Timing for CPU inner frame and GPU inner frame added

I've added two extra timers, and a renderFPSEx function to cope.

On Windows and Linux GLEW is likely required for the GPU timer query to compile. On OS X it should be part of the GL headers back to 10.7 as far as I can tell, but I've not tried. We could have an optional #define to remove these or to implement the prototype if needed.

The current naming for renderFPSEx and other functions is a bit abused here, but I've left renaming as an exercise for the repo owner, feel free to ask for changes and I can do them.

On the visual side it would be somewhat nicer for the counters to be vertically aligned, but doing so would need moving things around so I've not done that.

The timers don't time the frame swap, so as to more closely represent the actual cost of the nanovg rendering. On my system the CPU and GPU times are roughly balanced until I go fullscreen, where the GPU cost becomes slightly larger. Using the zoom function also increases GPU cost when fullscreen. The clear is being measured here on the GPU, potentially along with any waiting for the data to be uploaded - so it's not a pure measure of the draw call costs which would need moving the timer before the nvgEndFrame function - but this wouldn't time calls for the unbuffered implementation.