Bug 137897 - Use glFinish instead of glFlush when drawing final GL output to screen
Summary: Use glFinish instead of glFlush when drawing final GL output to screen
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-20 15:51 PDT by Roger Fong
Modified: 2014-10-20 18:07 PDT (History)
7 users (show)

See Also:


Attachments
patch (1.49 KB, patch)
2014-10-20 15:54 PDT, Roger Fong
bfulgham: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roger Fong 2014-10-20 15:51:31 PDT
When we want to draw the final WebGL output to the screen we call drawInCGLContext which in turn calls GraphicsContext3D::prepareTexture.
We used to call glFinish here, which pushes all buffered gl operations and blocks until every operation has been completed and every last pixel has been drawn.

glFlush also pushes all buffered gl operations but returns immediately.

Using glFinish is a huge performance hit and based on my testing does not seem to offer any particular benefit over glFlush.
Thus we will switch to using glFlush.

This gives us a 20% performance boost on Unity 3d tests and a 33% boost on the frame rate on http://threejs.org/examples/#webgl_performance.
Comment 1 Roger Fong 2014-10-20 15:54:52 PDT
Created attachment 240154 [details]
patch
Comment 2 Roger Fong 2014-10-20 15:57:02 PDT
We should commit this, live on it, and keep an eye out for any unforeseen consequences.
Comment 3 Roger Fong 2014-10-20 15:58:09 PDT
rdar://problem/15846550
Comment 4 Brent Fulgham 2014-10-20 16:16:31 PDT
Comment on attachment 240154 [details]
patch

Looks good! r=me.
Comment 5 Roger Fong 2014-10-20 18:07:56 PDT
http://trac.webkit.org/changeset/174915