[RFC] Avoiding some of the globals in glretrace

José Fonseca jose.r.fonseca at gmail.com
Wed Jun 15 16:13:06 UTC 2016


Hi,

Having an ABC for glws_*  sounds good.  I actually have an unfinished
branch to do something similar.  I have to see what's best.

But having an ABC for glretrace_* retrace_foo doesn't look right.  It's a
lot of complexity for no good benefit.  The callback table is nothing more
than a sorted map: no matter how many interations one does, it should
always yield the same result.   So I rather not have the complexity.  Let's
use some sort of once-init or singleton paradigm.

I don't understand the benefit of using std::function.

Jose


On Tue, Jun 7, 2016 at 8:14 AM, Трухин А. <alxtry at gmail.com> wrote:

> Hello,
>
> A bit of testing profiling with several passes revealed that globals
> indeed play a role in consistency of results. Though, the
> discrepancies are minor -- looks like it affects only the very
> beginning of the trace (I guess resetting visuals would be enough to
> avoid this actually).
>
> Nevertheless, I decided to try and remove some of globals (in window
> helpers and interfaces). I also think this can "improve" retracing
> several files (in one run) and make code generally more portable.
>
> Link to the branch: https://github.com/trtt/apitrace/commits/rmglob
>
> Brief summary:
> 1) Promote callbacks to std::function
> 2) Wrap GL window system helpers in class
> 3) Wrap glx, wgl etc. interfaces in classes (register callbacks with
> std::bind to the class object)
> 4) Instantiate Retracer object in the local scope of main loop
> 5) Instantiate and delete all the above every loop iteration
>
> What do you think?
> _______________________________________________
> apitrace mailing list
> apitrace at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/apitrace
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/apitrace/attachments/20160615/8b7da941/attachment.html>


More information about the apitrace mailing list