New issue
Advanced search Search tips

Issue 669840 link

Starred by 0 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

gl.finish doesn't wait until rendering finishes

Reported by marcin.i...@gmail.com, Nov 30 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce the problem:
1. Draw complex WebGL scene
2. gl.finish()
3. gl.finish() returns immediately within 3ms

Test demo here http://node.variable.io/p/pex/gl.finish/ (time is printed in console logs)

What is the expected behavior?
gl.finish() should wait until the scene finishes rendering e.g. 30ms. It's hard to believe that Chrome is 10x faster. Especially that time measured between requestAnimationFrame is 30ms+ in Chrome so the GPU is indeed doing the work.

What went wrong?
Looks like gl.finish() is not waiting for GPU to finish drawing and only waits until JavaScript finishes uploading the data to native layer / CPU / GPU.

In Safari and Firefox the JS thread will block until the frame finishes rendering.

As per GL ES Spec: 
"glFinish does not return until the effects of all previously called GL commands are complete. Such effects include all changes to GL state, all changes to connection state, and all changes to the frame buffer contents."
https://www.khronos.org/opengles/sdk/docs/man/xhtml/glFinish.xml

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 54.0.2840.98  Channel: stable
OS Version: OS X 10.12.1
Flash Version: Shockwave Flash 23.0 r0
 
Archive.zip
216 KB Download

Comment 1 by kbr@chromium.org, Nov 30 2016

Status: WontFix (was: Unconfirmed)
This is by design. There is no user-visible effect of glFinish in WebGL aside from the time it takes to execute. Chrome's graphics pipeline is much deeper and more asynchronous than on some of these other browsers and we do not want to encourage users to use it for timing. Use either the EXT_disjoint_timer_query extension or a tool like http://spite.github.io/rstats/ which measures the steady-state frame time in the application.

Sign in to add a comment