Profiling utilities

Together with @Xoppa I figured out a way to collect some benchmarking information like rendered tris of a `ModelBatch` or the total amount of gl calls that happened.

I think it might be useful to many people who want to do some performance optimizations, like reducing texture bindings by using texture atlasses or something similar.

There is a `Benchmark3DTest` which shows how the benchmark utilities are setup and how to get the information.

For now I measure the total gl calls, draw calls, texture bindings and shader switches (for this to work https://github.com/libgdx/libgdx/pull/1978 needs to be merged first). But this could be easily extended to also measure other special gl calls.
Oh no, a wild comment appeared!
On Jun 17, 2014 7:51 PM, "Xoppa" <notifications@github.com> wrote:

> In gdx/src/com/badlogic/gdx/graphics/profiling/GLProfiler.java:
>
> > +
> > +	/** Disables profiling by resetting the {@code GL20} and {@code GL30} instances with the original ones. */
> > +	public static void disable () {
> > +		if (Gdx.gl30 != null && Gdx.gl30 instanceof GL30Profiler) Gdx.gl30 = ((GL30Profiler)Gdx.gl30).gl30;
> > +		if (Gdx.gl20 != null && Gdx.gl20 instanceof GL20Profiler) Gdx.gl20 = ((GL20Profiler)Gdx.gl).gl20;
> > +		if (Gdx.gl != null && Gdx.gl instanceof GL20Profiler) Gdx.gl = ((GL20Profiler)Gdx.gl).gl20;
> > +	}
> > +
> > +	/** Will reset the statistical information which has been collected so far. This should be called after every frame. */
> > +	public static void reset () {
> > +		if (Gdx.gl30 != null && Gdx.gl30 instanceof GLProfiler) ((GLProfiler)Gdx.gl30).resetVariables();
> > +		if (Gdx.gl20 != null && Gdx.gl20 instanceof GLProfiler) ((GLProfiler)Gdx.gl).resetVariables();
> > +		if (Gdx.gl != null && Gdx.gl instanceof GLProfiler) ((GLProfiler)Gdx.gl).resetVariables();
> > +	}
> > +
> > +	protected void resetVariables () {
>
> This method can be a removed now and its content can be moved to the
> static reset method.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/libgdx/libgdx/pull/1979/files#r13874452>.
>