I can imagine many ways of solving this issue. For example, the call to counters.close() could check if a previous set of timers is available and call the callbacks. Or the application has to call settimeout (f,0) and split its rendering into several chunks. Which I think could work just fine in the case of multi pass rendering.
This said it seems to me we reached the main issue for this API design.
As I understand , you want to limit usage to let the user access the query values of a frame ONLY in the next frame.
In that case there is probably a simpler API design available given this restriction.
From: Florian Bösch <email@example.com>
Date: Friday, April 12, 2013 2:18 PM
To: Rémi Arnaud <firstname.lastname@example.org>
Cc: Rémi Arnaud <email@example.com>, Ben Vanik <firstname.lastname@example.org>, "email@example.com" <firstname.lastname@example.org>, Kenneth Russell <email@example.com>, Gregg Tavares <firstname.lastname@example.org>, Public Webgl <email@example.com>, Brian Cornell <firstname.lastname@example.org>, Glenn Maynard <email@example.com>
Subject: Re: [Public WebGL] For review: ANGLE_timer_query extension
JS can't call back inbetween executing JS or interrupt JS execution. The result would be an undefined interpreter state. A callback can only happen either immediately, or after all JS has finished running.
On Fri, Apr 12, 2013 at 11:13 PM, Rémi Arnaud <firstname.lastname@example.org> wrote: