[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] For review: ANGLE_timer_query extension



http://www.opengl.org/registry/specs/ARB/timer_query.txt

When BeginQuery and EndQuery are called with a <target> of
TIME_ELAPSED, the GL prepares to start and stop the timer used for
timer queries. The timer is started or stopped when the effects from all
previous commands on the GL client and server state and the framebuffer
have been fully realized.

It follows that all previous timing events have to be realized before the last one gets ready status.
 


On Fri, Apr 12, 2013 at 10:27 PM, Florian Bösch <pyalot@gmail.com> wrote:
On Fri, Apr 12, 2013 at 10:18 PM, Rémi Arnaud <jsremi@gmail.com> wrote:
I don't belive this to be true. 

 A timer is a resource allocated in the driver. There are multiple queues involved until a command hits the driver. Such as JS process -> GPU process -> driver process. The queue we're measuring with query objects is the execution queue in the driver. This queue runs down on flip. The queue is processed one command at a time, such as drawArrays, useShader etc. Some commands force a queue synchronization such as texImage2D, bufferData, readPixels and finish.

So while the driver is processing the queue it encounters the query timer commands. When it hits one, it stores the value in the query object it has allocated. Since by definition the queue for a frame is empty by the time flip returns, any timer query that mattered to that frame has now been filled with a timing value and its flag of "readyness" been set. Therefore all preceeding timer queries have the flag set as well, and are equally filled with a value.

Hence the last query in a frame is the only query that needs to be polled to know if all preceeding queries of a frame are ready and filled with timing values.