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 <firstname.lastname@example.org>
Date: Friday, April 12, 2013 2:18 PM
To: Rémi Arnaud <email@example.com>
Cc: Rémi Arnaud <firstname.lastname@example.org>, Ben Vanik <email@example.com>, "firstname.lastname@example.org" <email@example.com>, Kenneth Russell <firstname.lastname@example.org>, Gregg Tavares <email@example.com>, Public Webgl <firstname.lastname@example.org>, Brian Cornell <email@example.com>, Glenn Maynard <firstname.lastname@example.org>
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 <email@example.com> wrote: